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.
This commit is contained in:
Wenbin Hou 2018-08-15 10:11:49 +08:00 committed by GitHub
parent cbb9925a10
commit c981336445
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,8 +22,8 @@ if(WIN32)
link_libraries(ws2_32.lib)
endif()
include_directories("${CMAKE_SOURCE_DIR}/include" "${CMAKE_SOURCE_DIR}/src" "${CMAKE_BINARY_DIR}")
include_directories("${CMAKE_SOURCE_DIR}/external/unity")
include_directories("${ZeroMQ_SOURCE_DIR}/include" "${ZeroMQ_SOURCE_DIR}/src" "${ZeroMQ_BINARY_DIR}")
include_directories("${ZeroMQ_SOURCE_DIR}/external/unity")
foreach(test ${unittests})
# target_sources not supported before CMake 3.1
@ -31,7 +31,7 @@ foreach(test ${unittests})
# per-test directories not generated on OS X / Darwin
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()
target_link_libraries(${test} libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)