comparison Resources/Orthanc/CMake/Compiler.cmake @ 28:6fc06e1c5f57

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 Jan 2024 14:52:10 +0100
parents 1bda8ea224de
children 78f21b9263b1
comparison
equal deleted inserted replaced
27:bf4e5434567c 28:6fc06e1c5f57
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")
122 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR 129 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
123 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR 130 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
124 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR 131 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
125 ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") 132 ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
126 133
127 if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" AND 134 if (# NOT ${CMAKE_SYSTEM_VERSION} STREQUAL "LinuxStandardBase" AND
135 NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" AND
128 NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") 136 NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
129 # The "--no-undefined" linker flag makes the shared libraries 137 # The "--no-undefined" linker flag makes the shared libraries
130 # (plugins ModalityWorklists and ServeFolders) fail to compile on 138 # (plugins ModalityWorklists and ServeFolders) fail to compile on
131 # OpenBSD, and make the PostgreSQL plugin complain about missing 139 # OpenBSD, and make the PostgreSQL plugin complain about missing
132 # "environ" global variable in FreeBSD 140 # "environ" global variable in FreeBSD.
141 #
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.
133 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")
134 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")
135 endif() 147 endif()
136 148
137 # Remove the "-rdynamic" option 149 # Remove the "-rdynamic" option