From 34fb0125d891725c3b2107c1218452465be60b51 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Sun, 4 Oct 2020 22:29:54 +0200 Subject: [PATCH] CMake: include files with path BornAgain/* to avoid ambiguities while allowing for concise file names --- CMakeLists.txt | 30 ++++++++++++------- .../Compiler.cmake} | 10 ------- .../Config.cmake} | 0 .../Coverage.cmake} | 0 .../{modules => BornAgain}/Dependences.cmake | 0 .../{modules => BornAgain}/Directories.cmake | 0 .../LineLength.cmake} | 0 .../Linux.cmake} | 0 .../MacOS.cmake} | 0 .../Pack.cmake} | 6 ++-- .../PackDebian.cmake} | 0 .../PackMacOS.cmake} | 0 .../PackWindows.cmake} | 0 .../PythonDocs.cmake} | 0 .../SearchQt.cmake => BornAgain/Qt.cmake} | 0 .../Windows.cmake} | 0 .../NSIS.InstallOptions.ini.in | 0 .../NSIS.template.in | 0 18 files changed, 23 insertions(+), 23 deletions(-) rename cmake/{modules/CheckCompiler.cmake => BornAgain/Compiler.cmake} (87%) rename cmake/{modules/BornAgainConfiguration.cmake => BornAgain/Config.cmake} (100%) rename cmake/{modules/BACoverage.cmake => BornAgain/Coverage.cmake} (100%) rename cmake/{modules => BornAgain}/Dependences.cmake (100%) rename cmake/{modules => BornAgain}/Directories.cmake (100%) rename cmake/{modules/BALineLength.cmake => BornAgain/LineLength.cmake} (100%) rename cmake/{modules/SetUpLinux.cmake => BornAgain/Linux.cmake} (100%) rename cmake/{modules/SetUpMacOS.cmake => BornAgain/MacOS.cmake} (100%) rename cmake/{modules/BornAgainCPack.cmake => BornAgain/Pack.cmake} (95%) rename cmake/{modules/CPackDebian.cmake => BornAgain/PackDebian.cmake} (100%) rename cmake/{modules/CPackApple.cmake => BornAgain/PackMacOS.cmake} (100%) rename cmake/{modules/CPackWindows.cmake => BornAgain/PackWindows.cmake} (100%) rename cmake/{modules/GeneratePythonDocs.cmake => BornAgain/PythonDocs.cmake} (100%) rename cmake/{modules/SearchQt.cmake => BornAgain/Qt.cmake} (100%) rename cmake/{modules/SetUpWindows.cmake => BornAgain/Windows.cmake} (100%) rename cmake/{modules => configurables}/NSIS.InstallOptions.ini.in (100%) rename cmake/{modules => configurables}/NSIS.template.in (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 214abfacf87..66bea20472d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.14 FATAL_ERROR) set(CMAKE_MODULE_PATH - ${CMAKE_SOURCE_DIR}/cmake/modules # CMake modules specific for BornAgain ${CMAKE_SOURCE_DIR}/cmake/extensions # CMake modules for use in various projects + ${CMAKE_SOURCE_DIR}/cmake/ ) set(CONFIGURABLES_DIR ${CMAKE_SOURCE_DIR}/cmake/configurables) @@ -64,20 +64,30 @@ if(ALLCONFIG) endif() # include CMake macros and functions +#--- Setup details depending on the major platform type --- + +if(CMAKE_SYSTEM_NAME MATCHES Linux) + include(BornAgain/Linux) +elseif(APPLE) + include(BornAgain/MacOS) +elseif(WIN32) + include(BornAgain/Windows) +endif() + include(GetFilenameComponent) # overwrite CMake command -include(Directories) -include(CheckCompiler) -include(Dependences) +include(BornAgain/Directories) +include(BornAgain/Compiler) +include(BornAgain/Dependences) if(ZERO_TOLERANCE) string(APPEND CMAKE_CXX_FLAGS " -Werror -Wfatal-errors") endif() if(BORNAGAIN_GUI) - include(SearchQt) + include(BornAgain/Qt) string(APPEND CMAKE_CXX_FLAGS " -DHAVE_QT=ON") endif() -include(BornAgainConfiguration) -include(GeneratePythonDocs) -include(BALineLength) +include(BornAgain/Config) +include(BornAgain/PythonDocs) +include(BornAgain/LineLength) # debug optimization if(BORNAGAIN_DEBUG_OPTIMIZATION) @@ -87,7 +97,7 @@ endif() # code coverage analysis if(BORNAGAIN_COVERAGE) include(CoverageFunction) - include(BACoverage) + include(BornAgain/Coverage) endif() # recurse into the given subdirectories @@ -133,4 +143,4 @@ add_subdirectory(Tests/Functional) add_subdirectory(cmake) # make package targets -include(BornAgainCPack) +include(BornAgain/Pack) diff --git a/cmake/modules/CheckCompiler.cmake b/cmake/BornAgain/Compiler.cmake similarity index 87% rename from cmake/modules/CheckCompiler.cmake rename to cmake/BornAgain/Compiler.cmake index 1d6bd9de095..d86a4eb6a53 100644 --- a/cmake/modules/CheckCompiler.cmake +++ b/cmake/BornAgain/Compiler.cmake @@ -14,16 +14,6 @@ message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") find_package(Threads) -#--- Setup details depending on the major platform type --- - -if(CMAKE_SYSTEM_NAME MATCHES Linux) - include(SetUpLinux) -elseif(APPLE) - include(SetUpMacOS) -elseif(WIN32) - include(SetUpWindows) -endif() - #--- Print the final compiler flags --- message(STATUS "BornAgain Platform: ${BORNAGAIN_PLATFORM}") diff --git a/cmake/modules/BornAgainConfiguration.cmake b/cmake/BornAgain/Config.cmake similarity index 100% rename from cmake/modules/BornAgainConfiguration.cmake rename to cmake/BornAgain/Config.cmake diff --git a/cmake/modules/BACoverage.cmake b/cmake/BornAgain/Coverage.cmake similarity index 100% rename from cmake/modules/BACoverage.cmake rename to cmake/BornAgain/Coverage.cmake diff --git a/cmake/modules/Dependences.cmake b/cmake/BornAgain/Dependences.cmake similarity index 100% rename from cmake/modules/Dependences.cmake rename to cmake/BornAgain/Dependences.cmake diff --git a/cmake/modules/Directories.cmake b/cmake/BornAgain/Directories.cmake similarity index 100% rename from cmake/modules/Directories.cmake rename to cmake/BornAgain/Directories.cmake diff --git a/cmake/modules/BALineLength.cmake b/cmake/BornAgain/LineLength.cmake similarity index 100% rename from cmake/modules/BALineLength.cmake rename to cmake/BornAgain/LineLength.cmake diff --git a/cmake/modules/SetUpLinux.cmake b/cmake/BornAgain/Linux.cmake similarity index 100% rename from cmake/modules/SetUpLinux.cmake rename to cmake/BornAgain/Linux.cmake diff --git a/cmake/modules/SetUpMacOS.cmake b/cmake/BornAgain/MacOS.cmake similarity index 100% rename from cmake/modules/SetUpMacOS.cmake rename to cmake/BornAgain/MacOS.cmake diff --git a/cmake/modules/BornAgainCPack.cmake b/cmake/BornAgain/Pack.cmake similarity index 95% rename from cmake/modules/BornAgainCPack.cmake rename to cmake/BornAgain/Pack.cmake index b05f1002bd5..1970a78bd0e 100644 --- a/cmake/modules/BornAgainCPack.cmake +++ b/cmake/BornAgain/Pack.cmake @@ -19,11 +19,11 @@ endif() if(WIN32) - include(CPackWindows) + include(BornAgain/PackWindows) elseif(APPLE) - include(CPackApple) + include(BornAgain/PackMacOS) elseif(UNIX AND BUILD_DEBIAN) # one can build debian package only on UNIX system - include(CPackDebian) + include(BornAgain/PackDebian) else() set(CPACK_GENERATOR "TGZ") endif() diff --git a/cmake/modules/CPackDebian.cmake b/cmake/BornAgain/PackDebian.cmake similarity index 100% rename from cmake/modules/CPackDebian.cmake rename to cmake/BornAgain/PackDebian.cmake diff --git a/cmake/modules/CPackApple.cmake b/cmake/BornAgain/PackMacOS.cmake similarity index 100% rename from cmake/modules/CPackApple.cmake rename to cmake/BornAgain/PackMacOS.cmake diff --git a/cmake/modules/CPackWindows.cmake b/cmake/BornAgain/PackWindows.cmake similarity index 100% rename from cmake/modules/CPackWindows.cmake rename to cmake/BornAgain/PackWindows.cmake diff --git a/cmake/modules/GeneratePythonDocs.cmake b/cmake/BornAgain/PythonDocs.cmake similarity index 100% rename from cmake/modules/GeneratePythonDocs.cmake rename to cmake/BornAgain/PythonDocs.cmake diff --git a/cmake/modules/SearchQt.cmake b/cmake/BornAgain/Qt.cmake similarity index 100% rename from cmake/modules/SearchQt.cmake rename to cmake/BornAgain/Qt.cmake diff --git a/cmake/modules/SetUpWindows.cmake b/cmake/BornAgain/Windows.cmake similarity index 100% rename from cmake/modules/SetUpWindows.cmake rename to cmake/BornAgain/Windows.cmake diff --git a/cmake/modules/NSIS.InstallOptions.ini.in b/cmake/configurables/NSIS.InstallOptions.ini.in similarity index 100% rename from cmake/modules/NSIS.InstallOptions.ini.in rename to cmake/configurables/NSIS.InstallOptions.ini.in diff --git a/cmake/modules/NSIS.template.in b/cmake/configurables/NSIS.template.in similarity index 100% rename from cmake/modules/NSIS.template.in rename to cmake/configurables/NSIS.template.in -- GitLab