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] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /cmake/Modules/G4CMakeSettings.cmake (Version 11.3.0) and /cmake/Modules/G4CMakeSettings.cmake (Version 11.0.p4)


  1 #.rst:                                              1 #.rst:
  2 # G4CMakeSettings.cmake                             2 # G4CMakeSettings.cmake
  3 # ---------------------                             3 # ---------------------
  4 #                                                   4 #
  5 # Set defaults for core CMake behaviour useful      5 # Set defaults for core CMake behaviour useful or required for building,
  6 # testing and installing Geant4.                    6 # testing and installing Geant4.
  7                                                     7 
  8 #---------------------------------------------      8 #-----------------------------------------------------------------
  9 # License and Disclaimer                            9 # License and Disclaimer
 10 #                                                  10 #
 11 # The  Geant4 software  is  copyright of the C     11 # The  Geant4 software  is  copyright of the Copyright Holders  of
 12 # the Geant4 Collaboration.  It is provided  u     12 # the Geant4 Collaboration.  It is provided  under  the terms  and
 13 # conditions of the Geant4 Software License,       13 # conditions of the Geant4 Software License,  included in the file
 14 # LICENSE and available at  http://cern.ch/gea     14 # LICENSE and available at  http://cern.ch/geant4/license .  These
 15 # include a list of copyright holders.             15 # include a list of copyright holders.
 16 #                                                  16 #
 17 # Neither the authors of this software system,     17 # Neither the authors of this software system, nor their employing
 18 # institutes,nor the agencies providing financ     18 # institutes,nor the agencies providing financial support for this
 19 # work  make  any representation or  warranty,     19 # work  make  any representation or  warranty, express or implied,
 20 # regarding  this  software system or assume a     20 # regarding  this  software system or assume any liability for its
 21 # use.  Please see the license in the file  LI     21 # use.  Please see the license in the file  LICENSE  and URL above
 22 # for the full disclaimer and the limitation o     22 # for the full disclaimer and the limitation of liability.
 23 #                                                  23 #
 24 # This  code  implementation is the result of      24 # This  code  implementation is the result of  the  scientific and
 25 # technical work of the GEANT4 collaboration.      25 # technical work of the GEANT4 collaboration.
 26 # By using,  copying,  modifying or  distribut     26 # By using,  copying,  modifying or  distributing the software (or
 27 # any work based  on the software)  you  agree     27 # any work based  on the software)  you  agree  to acknowledge its
 28 # use  in  resulting  scientific  publications     28 # use  in  resulting  scientific  publications,  and indicate your
 29 # acceptance of all terms of the Geant4 Softwa     29 # acceptance of all terms of the Geant4 Software license.
 30 #                                                  30 #
 31 #---------------------------------------------     31 #-----------------------------------------------------------------
 32                                                    32 
 33 if(NOT __G4CMAKESETTINGS_INCLUDED)                 33 if(NOT __G4CMAKESETTINGS_INCLUDED)
 34   set(__G4CMAKESETTINGS_INCLUDED TRUE)             34   set(__G4CMAKESETTINGS_INCLUDED TRUE)
 35 else()                                             35 else()
 36   return()                                         36   return()
 37 endif()                                            37 endif()
 38                                                    38 
 39 #---------------------------------------------     39 #-----------------------------------------------------------------------
 40 #.rst:                                             40 #.rst:
 41 # General Configuration Settings                   41 # General Configuration Settings
 42 # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                   42 # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 43 #                                                  43 #
 44 # The following CMake modules and variables ar     44 # The following CMake modules and variables are used to control configuration time
 45 # behaviour such as location of dependencies.      45 # behaviour such as location of dependencies.
 46 #                                                  46 #
 47                                                    47 
 48 #.rst:                                             48 #.rst:
 49 # - ``G4CMakeUtilities`                            49 # - ``G4CMakeUtilities`
 50 #                                                  50 #
 51 #   - Included to provide additional macros an     51 #   - Included to provide additional macros and functions
 52 #                                                  52 #
 53 include(G4CMakeUtilities)                          53 include(G4CMakeUtilities)
 54                                                    54 
 55 #                                                  55 #
 56 # - ``CMAKE_EXPORT_NO_PACKAGE_REGISTRY`` : ON      56 # - ``CMAKE_EXPORT_NO_PACKAGE_REGISTRY`` : ON
 57 # - ``CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY``     57 # - ``CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY`` : ON
 58 # - ``CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REG     58 # - ``CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY`` : ON
 59 #                                                  59 #
 60 #   - These variables are set to ensure that C     60 #   - These variables are set to ensure that CMake never creates or searches
 61 #     for config files in any package registry     61 #     for config files in any package registry. This prevents the
 62 #     :cmake:command:`find_package <cmake:comm     62 #     :cmake:command:`find_package <cmake:command:find_package>`
 63 #     command from locating potentially spurio     63 #     command from locating potentially spurious config files.
 64 #                                                  64 #
 65 set(CMAKE_EXPORT_NO_PACKAGE_REGISTRY ON)           65 set(CMAKE_EXPORT_NO_PACKAGE_REGISTRY ON)
 66 set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY ON)     66 set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY ON)
 67 set(CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGIS     67 set(CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY ON)
 68                                                    68 
 69 #---------------------------------------------     69 #-----------------------------------------------------------------------
 70 #.rst:                                             70 #.rst:
 71 # General Build Settings                           71 # General Build Settings
 72 # ^^^^^^^^^^^^^^^^^^^^^^                           72 # ^^^^^^^^^^^^^^^^^^^^^^
 73 #                                                  73 #
 74 # The following CMake variables and options ar     74 # The following CMake variables and options are configured by default
 75 # when including this module:                      75 # when including this module:
 76 #                                                  76 #
 77 # - ``CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE     77 # - ``CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE`` : ON
 78 #                                                  78 #
 79 #   - Force project directories to appear firs     79 #   - Force project directories to appear first in any list of include paths.
 80 #     This applies to both full paths and thos     80 #     This applies to both full paths and those created by generator expressions.
 81 #                                                  81 #
 82 set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE O     82 set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
 83                                                    83 
 84 #.rst:                                             84 #.rst:
 85 # - ``CMAKE_LINK_DEPENDS_NO_SHARED`` : ON          85 # - ``CMAKE_LINK_DEPENDS_NO_SHARED`` : ON
 86 #                                                  86 #
 87 #   - Do not relink a target to any shared lib     87 #   - Do not relink a target to any shared library dependencies when
 88 #     only the shared library implementation h     88 #     only the shared library implementation has changed.
 89 #                                                  89 #
 90 set(CMAKE_LINK_DEPENDS_NO_SHARED ON)               90 set(CMAKE_LINK_DEPENDS_NO_SHARED ON)
 91                                                    91 
 92 #.rst:                                             92 #.rst:
 93 # A custom ``validate_sources`` targets is dec     93 # A custom ``validate_sources`` targets is declared to compare files listed
 94 # in `sources.cmake` scripts with on-disk file     94 # in `sources.cmake` scripts with on-disk files. As sources.cmake lists
 95 # source files of Geant4 explicitely, we can o     95 # source files of Geant4 explicitely, we can often a mismatch can occur
 96 # between this list and what's actually on dis     96 # between this list and what's actually on disk.
 97 #                                                  97 #
 98 # The ``validate_sources`` target executes a C     98 # The ``validate_sources`` target executes a CMake script to
 99 # check for these errors and report mismatches     99 # check for these errors and report mismatches. It fails with FATAL_ERROR
100 # if any mismatch is found, but will not do so    100 # if any mismatch is found, but will not do so until it has reported
101 # all errors.                                     101 # all errors.
102 # Configure the script                            102 # Configure the script
103 configure_file(                                   103 configure_file(
104   ${PROJECT_SOURCE_DIR}/cmake/Templates/geant4    104   ${PROJECT_SOURCE_DIR}/cmake/Templates/geant4_validate_sources.cmake.in
105   ${PROJECT_BINARY_DIR}/geant4_validate_source    105   ${PROJECT_BINARY_DIR}/geant4_validate_sources.cmake
106   @ONLY                                           106   @ONLY
107   )                                               107   )
108                                                   108 
109 # Create the target                               109 # Create the target
110 add_custom_target(validate_sources                110 add_custom_target(validate_sources
111   COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY    111   COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/geant4_validate_sources.cmake
112   COMMENT "Validating Geant4 Module Source Lis    112   COMMENT "Validating Geant4 Module Source Lists"
113   )                                               113   )
114                                                   114 
115 #.rst:                                            115 #.rst:
116 # Custom ``validate_no_module_cycles`` and ``v << 116 # A custom ``validate_no_module_cycles`` is declared if Python3.9 is available.
117 # are declared if Python3.9 is available.      << 117 # This runs the geant4_check_module_cycles Python script to check that the
118 # These runs the geant4_module_check.py Python << 118 # source module dependency graph has no cycles. It will fail if any cycles
119 # inconsistencies in the module dependency gra << 119 # are found, listing the first found to stderr.
120 find_package(Python3 3.9 QUIET COMPONENTS Inte    120 find_package(Python3 3.9 QUIET COMPONENTS Interpreter)
121 if(Python3_FOUND)                                 121 if(Python3_FOUND)
122   set(G4MODULE_VALIDATION_CMD Python3::Interpr << 
123     ${PROJECT_SOURCE_DIR}/cmake/Modules/geant4 << 
124     -db ${PROJECT_BINARY_DIR}/G4ModuleInterfac << 
125                                                << 
126   add_custom_target(validate_no_module_cycles     122   add_custom_target(validate_no_module_cycles
127     COMMAND ${G4MODULE_VALIDATION_CMD} --find- << 123     COMMAND Python3::Interpreter
                                                   >> 124             ${PROJECT_SOURCE_DIR}/cmake/Modules/geant4_check_module_cycles.py
                                                   >> 125             -f ${PROJECT_BINARY_DIR}/G4ModuleAdjacencyList.txt
128     COMMENT "Checking for cycles in declared s    126     COMMENT "Checking for cycles in declared source module dependencies"
129     )                                             127     )
130                                                << 
131   add_custom_target(validate_module_consistenc << 
132     COMMAND ${G4MODULE_VALIDATION_CMD} --find- << 
133     COMMENT "Checking for inconsistencies in d << 
134     USES_TERMINAL                              << 
135     )                                          << 
136 endif()                                           128 endif()
137                                                   129 
138 #---------------------------------------------    130 #-----------------------------------------------------------------------
139 #.rst:                                            131 #.rst:
140 # General Installation Settings                   132 # General Installation Settings
141 # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                   133 # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
142 #                                                 134 #
143 # Geant4 custom defaults                          135 # Geant4 custom defaults
144                                                   136 
145 set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PA    137 set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH
146   "Read-only architecture-independent data roo    138   "Read-only architecture-independent data root (share)")
147                                                   139 
148 set(CMAKE_INSTALL_DATADIR                         140 set(CMAKE_INSTALL_DATADIR
149   "${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME << 141   "${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}" CACHE PATH
150   "Read-only architecture-independent data (DA << 142   "Read-only architecture-independent data (DATAROOTDIR/${PROJECT_NAME}-${${PROJECT_NAME}_VERSION})")
151                                                   143 
152 #                                                 144 #
153 # CMake's builtin `GNUInstallDirs` module is u    145 # CMake's builtin `GNUInstallDirs` module is used to set and provide variables
154 # for the destinations to which for executable    146 # for the destinations to which for executables, libraries and other files
155 # should be installed.                            147 # should be installed.
156 #                                                 148 #
157 include(GNUInstallDirs)                           149 include(GNUInstallDirs)
158                                                   150 
159 # Check for non-relocatable install directorie    151 # Check for non-relocatable install directories
160 foreach(dir                                       152 foreach(dir
161     BINDIR                                        153     BINDIR
162     LIBDIR                                        154     LIBDIR
163     INCLUDEDIR                                    155     INCLUDEDIR
164     DATAROOTDIR                                   156     DATAROOTDIR
165     DATADIR                                       157     DATADIR
166     MANDIR                                        158     MANDIR
167     DOCDIR                                        159     DOCDIR
168     )                                             160     )
169   if(IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})         161   if(IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
170     set(CMAKE_INSTALL_IS_NONRELOCATABLE 1)        162     set(CMAKE_INSTALL_IS_NONRELOCATABLE 1)
171   endif()                                         163   endif()
172 endforeach()                                      164 endforeach()
173                                                   165 
174 #.rst:                                            166 #.rst:
175 # The following CMake variables are additional    167 # The following CMake variables are additionally set to control install
176 # policy and reporting:                           168 # policy and reporting:
177                                                   169 
178 #.rst:                                            170 #.rst:
179 # - ``CMAKE_INSTALL_MESSAGE`` : ``LAZY``          171 # - ``CMAKE_INSTALL_MESSAGE`` : ``LAZY``
180 #                                                 172 #
181 #   - Only report new or updated files install    173 #   - Only report new or updated files installed by the ``install`` target.
182 #                                                 174 #
183 set(CMAKE_INSTALL_MESSAGE LAZY)                   175 set(CMAKE_INSTALL_MESSAGE LAZY)
184                                                   176 
185 #.rst:                                            177 #.rst:
186 # An `uninstall` target is provided to assist     178 # An `uninstall` target is provided to assist in removing previously installed
187 # files. It will not remove any installed dire    179 # files. It will not remove any installed directories per standard behaviour.
188 # Note that if files are removed from the inst    180 # Note that if files are removed from the install manifest between invocations
189 # of the `install` and `uninstall` targets, th    181 # of the `install` and `uninstall` targets, they will *not* be removed by the
190 # latter.                                         182 # latter.
191 #                                                 183 #
192 include(CMakeUninstallTarget)                     184 include(CMakeUninstallTarget)
193                                                   185