From 92ee5ee95949352dba70ca9bce417bdab4a7b4d4 Mon Sep 17 00:00:00 2001 From: Florent Lamiraux <florent@laas.fr> Date: Mon, 3 Feb 2020 16:21:48 +0100 Subject: [PATCH] Add Cmake option to deactivate suffix of so files. Force tests to link with the library in build directory. --- CMakeLists.txt | 8 +++++++- tests/CMakeLists.txt | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16cc5185..63740f71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,7 +170,13 @@ target_include_directories(${PROJECT_NAME} $<INSTALL_INTERFACE:include> ) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION}) +OPTION(SUFFIX_SO_VERSION + "Suffix shared library name by a string depending on git status of project" + ON) + +IF (${SUFFIX_SO_VERSION} EQUAL "ON") + SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION}) +ENDIF () IF (UNIX) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${CMAKE_DL_LIBS} pthread) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6561cf42..7924f1d6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -2,6 +2,7 @@ # ADD_DEFINITIONS(-DDEBUG=2) +SET(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} -Wl,--disable-new-dtags) # Add Boost path to include directories. #INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) -- GitLab