CMake - fix building tests for Visual Studio.

Need to include lib sources directly to test project also.
This commit is contained in:
Kimmo Varis 2010-02-01 20:16:30 +02:00
parent 64afcc8179
commit 6f47f77977
1 changed files with 7 additions and 5 deletions

View File

@ -32,10 +32,12 @@ SET(CHECKTEST_SRCS
testmathlib.cpp testmathlib.cpp
) )
aux_source_directory(${CPPCHECK_SOURCE_DIR}/lib LIB_SRCS)
# Libraries to link # Libraries to link
set(CHECK_LIBS #set(CHECK_LIBS
checklib # checklib
) #)
# Windows needs additional shlwapi library # Windows needs additional shlwapi library
if (WIN32 AND NOT CYGWIN) if (WIN32 AND NOT CYGWIN)
@ -53,11 +55,11 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif (CMAKE_COMPILER_IS_GNUCXX) endif (CMAKE_COMPILER_IS_GNUCXX)
include_directories (${CPPCHECK_SOURCE_DIR}/lib) include_directories (${CPPCHECK_SOURCE_DIR}/lib)
ADD_EXECUTABLE(test ${CHECKTEST_SRCS} ${CHECKTEST_HDRS}) ADD_EXECUTABLE(test ${CHECKTEST_SRCS} ${CHECKTEST_HDRS} ${LIB_SRCS})
TARGET_LINK_LIBRARIES(test ${CHECK_LIBS}) TARGET_LINK_LIBRARIES(test ${CHECK_LIBS})
# Add custom 'make check' -target # Add custom 'make check' -target
# It compiles and runs tests # It compiles and runs tests
add_custom_target(check COMMAND test) add_custom_target(check COMMAND test)
add_dependencies(check test checklib) add_dependencies(check test)