Link against msgpack-static when shared disabled

This commit causes the tests to be linked against the msgpack-static
target if MSGPACK_ENABLE_SHARED is set to OFF.
This commit is contained in:
James Nugent 2015-07-23 22:10:41 -04:00 committed by James Nugent
parent 5f1d5e8722
commit 60e737f622

View File

@ -50,6 +50,12 @@ IF (MSGPACK_CXX11)
)
ENDIF ()
IF (MSGPACK_ENABLE_SHARED)
SET (MSGPACK_TEST_LIB msgpack)
ELSE ()
SET (MSGPACK_TEST_LIB msgpack-static)
ENDIF ()
FOREACH (source_file ${check_PROGRAMS})
GET_FILENAME_COMPONENT (source_file_we ${source_file} NAME_WE)
ADD_EXECUTABLE (
@ -57,7 +63,7 @@ FOREACH (source_file ${check_PROGRAMS})
${source_file}
)
TARGET_LINK_LIBRARIES (${source_file_we}
msgpack
${MSGPACK_TEST_LIB}
${GTEST_BOTH_LIBRARIES}
${ZLIB_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}