Commit 7b458fa3 authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

[CMake] Fix usage of BUILD_TESTING + target_link_libraries

parent 55c97280
......@@ -59,6 +59,7 @@ include(cmake/python.cmake)
include(cmake/hpp.cmake)
include(cmake/apple.cmake)
include(cmake/ide.cmake)
include(cmake/test.cmake)
# If needed, fix CMake policy for APPLE systems
APPLY_DEFAULT_APPLE_CONFIGURATION()
......@@ -156,9 +157,7 @@ add_subdirectory(src)
if (BUILD_PYTHON_INTERFACE)
add_subdirectory(python)
endif ()
if (BUILD_TESTING)
add_subdirectory(test)
endif ()
add_subdirectory(test)
pkg_config_append_libs("hpp-fcl")
PKG_CONFIG_APPEND_BOOST_LIBS(thread date_time filesystem system)
......
config_files(fcl_resources/config.h)
macro(add_fcl_test test_name)
add_executable(${ARGV})
macro(add_fcl_test test_name source)
ADD_UNIT_TEST(${test_name} ${source})
target_link_libraries(${test_name}
PUBLIC
${PROJECT_NAME}
hpp-fcl
${Boost_LIBRARIES}
Boost::unit_test_framework
utility
)
PKG_CONFIG_USE_DEPENDENCY(${test_name} assimp)
add_test(${test_name} ${EXECUTABLE_OUTPUT_PATH}/${test_name})
target_compile_options(${test_name} PRIVATE "-Wno-c99-extensions")
endmacro(add_fcl_test)
......@@ -54,7 +53,11 @@ if(HPP_FCL_HAVE_OCTOMAP)
endif(HPP_FCL_HAVE_OCTOMAP)
## Benchmark
add_executable(test-benchmark benchmark.cpp)
IF(BUILD_TESTING)
add_executable(test-benchmark benchmark.cpp)
ELSE()
add_executable(test-benchmark EXCLUDE_FROM_ALL benchmark.cpp)
ENDIF()
target_link_libraries(test-benchmark
PUBLIC
utility
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment