Skip to content

Commit

Permalink
Merge pull request lcm-proj#101 from ashuang/cmake-test-fix
Browse files Browse the repository at this point in the history
tests/cpp fix for CMake < 3.3
  • Loading branch information
ashuang authored Sep 5, 2016
2 parents 7bb005c + 084400c commit 5ac7b65
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
set(test_cpp_libs lcm-test-types-cpp lcm gtest gtest_main)
if(CMAKE_VERSION VERSION_LESS 3.3) # TODO remove when we require >=3.3
# NOTE: with CMake 3.3 or later, this is added as a dependency of the
# lcm-test-types-cpp INTERFACE target, so is not needed; CMake prior to
# 3.3 does not support dependencies on INTERFACE targets, and we need to
# enforce the build order for obvious reasons
list(APPEND test_cpp_libs lcm-test-types-generate-cpp)
endif()

add_executable(test-cpp-client client.cpp common.cpp)
target_link_libraries(test-cpp-client ${test_cpp_libs})

add_executable(test-cpp-memq_test memq_test.cpp common.cpp)
target_link_libraries(test-cpp-memq_test ${test_cpp_libs})

if(CMAKE_VERSION VERSION_LESS 3.3) # TODO remove when we require >=3.3
# NOTE: with CMake 3.3 or later, this is added as a dependency of the
# lcm-test-types-cpp INTERFACE target, so is not needed; CMake prior to
# 3.3 does not support dependencies on INTERFACE targets, and we need to
# enforce the build order for obvious reasons
add_dependencies(test-cpp-client lcm-test-types-generate-cpp)
add_dependencies(test-cpp-memq_test lcm-test-types-generate-cpp)
endif()

add_test(NAME CPP::memq_test COMMAND test-cpp-memq_test)

if(PYTHON_EXECUTABLE)
Expand Down

0 comments on commit 5ac7b65

Please sign in to comment.