Unverified Commit c9813364 authored by Wenbin Hou's avatar Wenbin Hou Committed by GitHub

Udpate unittests/CMakeLists.txt: use ZeroMQ_SOURCE_DIR, ZeroMQ_BINARY_DIR

Use ZeroMQ_SOURCE_DIR, ZeroMQ_BINARY_DIR instead of CMAKE_SOURCE_DIR, CMAKE_BINARY_DIR, which allows libzmq to become an "add_subdirectory" target (with static build).
Otherwise, building unittest_xxx would complain header files not found.
parent cbb9925a
...@@ -22,8 +22,8 @@ if(WIN32) ...@@ -22,8 +22,8 @@ if(WIN32)
link_libraries(ws2_32.lib) link_libraries(ws2_32.lib)
endif() endif()
include_directories("${CMAKE_SOURCE_DIR}/include" "${CMAKE_SOURCE_DIR}/src" "${CMAKE_BINARY_DIR}") include_directories("${ZeroMQ_SOURCE_DIR}/include" "${ZeroMQ_SOURCE_DIR}/src" "${ZeroMQ_BINARY_DIR}")
include_directories("${CMAKE_SOURCE_DIR}/external/unity") include_directories("${ZeroMQ_SOURCE_DIR}/external/unity")
foreach(test ${unittests}) foreach(test ${unittests})
# target_sources not supported before CMake 3.1 # target_sources not supported before CMake 3.1
...@@ -31,7 +31,7 @@ foreach(test ${unittests}) ...@@ -31,7 +31,7 @@ foreach(test ${unittests})
# per-test directories not generated on OS X / Darwin # per-test directories not generated on OS X / Darwin
if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang.*") if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang.*")
link_directories(${test} PRIVATE "${CMAKE_SOURCE_DIR}/../lib") link_directories(${test} PRIVATE "${ZeroMQ_SOURCE_DIR}/../lib")
endif() endif()
target_link_libraries(${test} libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity) target_link_libraries(${test} libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
......
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