0% found this document useful (0 votes)
20 views1 page

CMake Lists

This document is a CMakeLists.txt file for building the Geant4 project, which enforces out-of-source builds and specifies minimum CMake version requirements. It defines project versioning and sets up custom CMake modules for the build process. Additionally, it includes a main CMake module for convenience in tagging the project categories.

Uploaded by

godesi2695
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views1 page

CMake Lists

This document is a CMakeLists.txt file for building the Geant4 project, which enforces out-of-source builds and specifies minimum CMake version requirements. It defines project versioning and sets up custom CMake modules for the build process. Additionally, it includes a main CMake module for convenience in tagging the project categories.

Uploaded by

godesi2695
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

#-----------------------------------------------------------------------

# - Top Level [Link] for Geant4 Build


#-----------------------------------------------------------------------
# - Enforce an out-of-source builds before anything else
#
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(STATUS "Geant4 requires an out-of-source build.")
message(STATUS "Please remove these files from ${CMAKE_BINARY_DIR} first:")
message(STATUS "[Link]")
message(STATUS "CMakeFiles")
message(STATUS "Once these files are removed, create a separate directory")
message(STATUS "and run CMake from there")
message(FATAL_ERROR "in-source build detected")
endif()

#-----------------------------------------------------------------------
# - Define CMake requirements and override make rules as needed
#
cmake_minimum_required(VERSION 3.8...3.18 FATAL_ERROR)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
set(CMAKE_OSX_ARCHITECTURES "x86_64")

# - Make overrides for default flags, so they appear in interfaces


set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
${CMAKE_SOURCE_DIR}/cmake/Modules/G4MakeRules_cxx.cmake)

#-----------------------------------------------------------------------
# - Project definition and basic configuration
# Version handled manually as project(... VERSION ...) is not used
# in tests/examples which are subprojects. All calls must use
# the same form.
project(Geant4)
set(${PROJECT_NAME}_VERSION_MAJOR 10)
set(${PROJECT_NAME}_VERSION_MINOR 7)
set(${PROJECT_NAME}_VERSION_PATCH 3)
set(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${$
{PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}")

# - Prepend our own CMake Modules to the search path


# NB: if our custom modules include others that we don't supply, those in
# the base path will be used, so watch for incompatibilities!!
#
set(CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake/Modules
${CMAKE_MODULE_PATH})

#-----------------------------------------------------------------------
# - Include CMake category main module
# Factored into category for convenience in tagging
#
include(G4CMakeMain)

You might also like