Remove pthread dependency from test target
This commit is contained in:
parent
7be0b15d37
commit
7b946864a6
|
@ -1,5 +1,11 @@
|
|||
# before including this module, BasicConfig must be included
|
||||
|
||||
# always link test applications against c++utilities and cppunit
|
||||
find_library(CPP_UNIT_LIB cppunit)
|
||||
|
||||
if(CPP_UNIT_LIB)
|
||||
list(APPEND TEST_LIBRARIES ${CPP_UTILITIES_LIB} ${CPP_UNIT_LIB})
|
||||
|
||||
# add autotools-style check target
|
||||
if(NOT TARGET check)
|
||||
set(CMAKE_CTEST_COMMAND ctest -V)
|
||||
|
@ -10,11 +16,6 @@ endif()
|
|||
# add test executable, but exclude it from the "all target"
|
||||
add_executable(${META_PROJECT_NAME}_tests EXCLUDE_FROM_ALL ${TEST_HEADER_FILES} ${TEST_SRC_FILES})
|
||||
|
||||
# always link test applications against c++utilities, cppunit and pthreads
|
||||
find_library(CPP_UNIT_LIB cppunit)
|
||||
find_library(PTHREAD_LIB pthread)
|
||||
list(APPEND TEST_LIBRARIES ${CPP_UTILITIES_LIB} ${CPP_UNIT_LIB} ${PTHREAD_LIB})
|
||||
|
||||
# test applications of my projects always use c++utilities and cppunit
|
||||
if(NOT META_PROJECT_TYPE OR "${META_PROJECT_TYPE}" STREQUAL "library") # default project type is library
|
||||
# when testing a library, the test application always needs to link against it
|
||||
|
@ -46,3 +47,8 @@ if(MINGW AND CMAKE_CROSSCOMPILING AND CPP_UTILITIES_SOURCE_DIR)
|
|||
add_dependencies(${META_PROJECT_NAME}_run_tests ${META_PROJECT_NAME}_tests)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
else()
|
||||
message(WARNING "Unable to add test target because cppunit could not be located.")
|
||||
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue