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