comparison OrthancFramework/Resources/CMake/Compiler.cmake @ 5483:e7a04f878704

fix build of Orthanc Framework shared library on LSB
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 22 Dec 2023 10:29:07 +0100
parents dc8e5c65be99
children 48b8dae6dc77
comparison
equal deleted inserted replaced
5479:dc8e5c65be99 5483:e7a04f878704
41 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") 41 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
42 # Cache the environment variables "LSB_CC" and "LSB_CXX" for further 42 # Cache the environment variables "LSB_CC" and "LSB_CXX" for further
43 # use by "ExternalProject" in CMake 43 # use by "ExternalProject" in CMake
44 SET(CMAKE_LSB_CC $ENV{LSB_CC} CACHE STRING "") 44 SET(CMAKE_LSB_CC $ENV{LSB_CC} CACHE STRING "")
45 SET(CMAKE_LSB_CXX $ENV{LSB_CXX} CACHE STRING "") 45 SET(CMAKE_LSB_CXX $ENV{LSB_CXX} CACHE STRING "")
46
47 # This is necessary to build "Orthanc mainline - Framework LSB
48 # Release" on "buildbot-worker-debian11"
49 set(LSB_PTHREAD_NONSHARED "${LSB_PATH}/lib64-${LSB_TARGET_VERSION}/libpthread_nonshared.a")
50 if (EXISTS ${LSB_PTHREAD_NONSHARED})
51 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LSB_PTHREAD_NONSHARED}")
52 endif()
46 endif() 53 endif()
47 54
48 55
49 if (CMAKE_COMPILER_IS_GNUCXX) 56 if (CMAKE_COMPILER_IS_GNUCXX)
50 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-long-long") 57 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-long-long")
128 NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" AND 135 NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" AND
129 NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") 136 NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
130 # The "--no-undefined" linker flag makes the shared libraries 137 # The "--no-undefined" linker flag makes the shared libraries
131 # (plugins ModalityWorklists and ServeFolders) fail to compile on 138 # (plugins ModalityWorklists and ServeFolders) fail to compile on
132 # OpenBSD, and make the PostgreSQL plugin complain about missing 139 # OpenBSD, and make the PostgreSQL plugin complain about missing
133 # "environ" global variable in FreeBSD. Furthermore, on Linux 140 # "environ" global variable in FreeBSD.
134 # Standard Base running on Debian 12, the "-Wl,--no-undefined" 141 #
135 # breaks the compilation (added after Orthanc 1.12.2). 142 # TODO - Furthermore, on Linux Standard Base running on Debian 12,
143 # the "-Wl,--no-undefined" seems to break the compilation (added
144 # after Orthanc 1.12.2). This is disabled for now.
136 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined") 145 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined")
137 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") 146 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
138 endif() 147 endif()
139 148
140 # Remove the "-rdynamic" option 149 # Remove the "-rdynamic" option