Skip to content

Commit 5edf3ef

Browse files
authored
Remove caching cmake vars (#1313)
* Remove Caching of global CMake variables. * Add comment to non standard cmake variables which previously given in CACHE string. * Need a commit to trigger workflows. * Need a commit to trigger workflows. * Replace set_property by set since no Cache value has to be changed. Co-authored-by: Nils Schild <nils.schild@ipp.mpg.de>
1 parent 0a6e360 commit 5edf3ef

1 file changed

Lines changed: 12 additions & 22 deletions

File tree

CMakeLists.txt

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,21 @@ endif()
4444
#
4545
# temporary build directories
4646
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
47-
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
48-
CACHE PATH "Build directory for archives")
47+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
4948
endif()
5049
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
51-
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
52-
CACHE PATH "Build directory for libraries")
50+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
5351
endif()
5452
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
55-
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
56-
CACHE PATH "Build directory for binaries")
53+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
5754
endif()
5855
# install directories
5956
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
6057
include(GNUInstallDirs)
61-
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/openPMD"
62-
CACHE PATH "CMake config package location for installed targets")
58+
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/openPMD")
6359
if(WIN32)
64-
set(CMAKE_INSTALL_LIBDIR Lib
65-
CACHE PATH "Object code libraries")
66-
set_property(CACHE CMAKE_INSTALL_CMAKEDIR PROPERTY VALUE "cmake")
60+
set(CMAKE_INSTALL_LIBDIR Lib)
61+
set(CMAKE_INSTALL_CMAKEDIR "cmake")
6762
endif()
6863
endif()
6964

@@ -98,8 +93,7 @@ option(openPMD_USE_VERIFY "Enable internal VERIFY (assert) macro independent of
9893

9994
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
10095
if(NOT CMAKE_BUILD_TYPE)
101-
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
102-
"Choose the build type, e.g. Release or Debug." FORCE)
96+
set(CMAKE_BUILD_TYPE "Release")
10397
endif()
10498

10599
include(CMakeDependentOption)
@@ -746,20 +740,16 @@ if(openPMD_HAVE_PYTHON)
746740

747741
if(WIN32)
748742
set(CMAKE_INSTALL_PYTHONDIR_DEFAULT
749-
"${CMAKE_INSTALL_LIBDIR}/site-packages"
750-
)
743+
"${CMAKE_INSTALL_LIBDIR}/site-packages")
751744
else()
752745
set(CMAKE_INSTALL_PYTHONDIR_DEFAULT
753746
"${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages"
754747
)
755748
endif()
756-
set(CMAKE_INSTALL_PYTHONDIR "${CMAKE_INSTALL_PYTHONDIR_DEFAULT}"
757-
CACHE STRING "Location for installed python package"
758-
)
759-
set(CMAKE_PYTHON_OUTPUT_DIRECTORY
760-
"${openPMD_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}"
761-
CACHE PATH "Build directory for python modules"
762-
)
749+
# Location for installed python package
750+
set(CMAKE_INSTALL_PYTHONDIR "${CMAKE_INSTALL_PYTHONDIR_DEFAULT}")
751+
# Build directory for python modules
752+
set(CMAKE_PYTHON_OUTPUT_DIRECTORY "${openPMD_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}")
763753
set_target_properties(openPMD.py PROPERTIES
764754
ARCHIVE_OUTPUT_NAME openpmd_api_cxx
765755
LIBRARY_OUTPUT_NAME openpmd_api_cxx

0 commit comments

Comments
 (0)