Skip to content

Commit

Permalink
Merge pull request #231 from whoshuu/test/refactor-cmake
Browse files Browse the repository at this point in the history
Refactor CMakeLists.txt for tests
  • Loading branch information
whoshuu committed Oct 27, 2017
2 parents d3af63a + 018e841 commit cda6591
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions test/CMakeLists.txt
@@ -1,12 +1,18 @@
find_package(Threads)
set(TEST_SERVER_LIBRARY test_server)
add_library(${TEST_SERVER_LIBRARY}
server.cpp)
target_link_libraries(${TEST_SERVER_LIBRARY}
${MONGOOSE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT})

macro(add_cpr_test _TEST_NAME)
find_package(Threads)
add_executable(${_TEST_NAME}_tests
${_TEST_NAME}_tests.cpp server.cpp server.h)
${_TEST_NAME}_tests.cpp)
target_link_libraries(${_TEST_NAME}_tests
${TEST_SERVER_LIBRARY}
${GTEST_LIBRARIES}
${CPR_LIBRARIES}
${MONGOOSE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT})
${CPR_LIBRARIES})
add_test(NAME cpr_${_TEST_NAME}_tests COMMAND ${_TEST_NAME}_tests)
# Group under the "tests" project folder in IDEs such as Visual Studio.
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
Expand Down

0 comments on commit cda6591

Please sign in to comment.