comparison Resources/Orthanc/CMake/Compiler.cmake @ 153:c78ec45f3695

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 16 Mar 2024 11:55:27 +0100
parents 4cf3c2bc119f
children 6fada29b6759
comparison
equal deleted inserted replaced
150:3c98306828de 153:c78ec45f3695
1 # Orthanc - A Lightweight, RESTful DICOM Store 1 # Orthanc - A Lightweight, RESTful DICOM Store
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics 2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
3 # Department, University Hospital of Liege, Belgium 3 # Department, University Hospital of Liege, Belgium
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium 4 # Copyright (C) 2017-2024 Osimis S.A., Belgium
5 # Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium 5 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
6 # 6 #
7 # This program is free software: you can redistribute it and/or 7 # This program is free software: you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public License 8 # modify it under the terms of the GNU Lesser General Public License
9 # as published by the Free Software Foundation, either version 3 of 9 # as published by the Free Software Foundation, either version 3 of
10 # the License, or (at your option) any later version. 10 # the License, or (at your option) any later version.
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