From b49ac27c12d97d06095d3c5ba316cf7bca990e57 Mon Sep 17 00:00:00 2001 From: Oliver Glandberger Date: Tue, 28 Jan 2025 11:38:21 +0100 Subject: [PATCH 1/4] Add initial code including additional suggestions provided by 'MaximilienNaveau'. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c068ace..39c0667 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,11 @@ cmake_minimum_required(VERSION 3.8) project(qualisys_cpp_sdk) option(${PROJECT_NAME}_BUILD_EXAMPLES "Build examples" OFF) +option(SUFFIX_SO_VERSION "Suffix library name with its version" OFF) +if(SUFFIX_SO_VERSION) + option(CMAKE_POSITION_INDEPENDENT_CODE "Use position independent code" ON) +endif() add_library(${PROJECT_NAME} Markup.cpp From 07c99c05dce498e3eb1ecde00debab8471017679 Mon Sep 17 00:00:00 2001 From: Oliver Glandberger Date: Mon, 17 Feb 2025 15:35:37 +0100 Subject: [PATCH 2/4] New change was only partially correct. Fixing to incorporate other compilers. --- CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 39c0667..243e87e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,9 +5,17 @@ option(${PROJECT_NAME}_BUILD_EXAMPLES "Build examples" OFF) option(SUFFIX_SO_VERSION "Suffix library name with its version" OFF) if(SUFFIX_SO_VERSION) - option(CMAKE_POSITION_INDEPENDENT_CODE "Use position independent code" ON) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() +target_compile_options(${PROJECT_NAME} + PUBLIC + $<$:-fPIC> + $<$:-fPIC> + $<$:-fPIC> + $<$:-fPIC> +) + add_library(${PROJECT_NAME} Markup.cpp Network.cpp From a9bf66d737653ec8d52508b95687f40f303e1279 Mon Sep 17 00:00:00 2001 From: Oliver Glandberger Date: Mon, 17 Feb 2025 15:39:08 +0100 Subject: [PATCH 3/4] Update order of operations in CMakeLists.txt. --- CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca8972a..c93fa24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,14 +10,6 @@ if(SUFFIX_SO_VERSION) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() -target_compile_options(${PROJECT_NAME} - PUBLIC - $<$:-fPIC> - $<$:-fPIC> - $<$:-fPIC> - $<$:-fPIC> -) - set(tinyxml2_BUILD_TESTING OFF) add_subdirectory(external/tinyxml2) @@ -32,6 +24,14 @@ add_library(${PROJECT_NAME} SettingsSerializer.cpp ) +target_compile_options(${PROJECT_NAME} + PUBLIC + $<$:-fPIC> + $<$:-fPIC> + $<$:-fPIC> + $<$:-fPIC> +) + target_include_directories(${PROJECT_NAME} PUBLIC $ $ From 631dc9a0c763701fe4812fe868ebb8ed6956649b Mon Sep 17 00:00:00 2001 From: Oliver Glandberger Date: Mon, 17 Feb 2025 15:39:50 +0100 Subject: [PATCH 4/4] Update order of operations in CMakeLists.txt. --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c93fa24..883dcd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,9 +6,6 @@ option(${PROJECT_NAME}_BUILD_TESTS "Build tests" OFF) option(SUFFIX_SO_VERSION "Suffix library name with its version" OFF) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") -if(SUFFIX_SO_VERSION) - set(CMAKE_POSITION_INDEPENDENT_CODE ON) -endif() set(tinyxml2_BUILD_TESTING OFF) add_subdirectory(external/tinyxml2) @@ -24,6 +21,9 @@ add_library(${PROJECT_NAME} SettingsSerializer.cpp ) +if(SUFFIX_SO_VERSION) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) +endif() target_compile_options(${PROJECT_NAME} PUBLIC $<$:-fPIC>