diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2019-12-08 02:39:02 +0200 |
---|---|---|
committer | Alex Turbov <i.zaufi@gmail.com> | 2019-12-10 16:43:27 +0200 |
commit | 24fdd51f4503ccee33c07881cc8dd487cdc8b347 (patch) | |
tree | ff07504a0782e3a79fb996594d9fcbcabf98ecf0 /Modules | |
parent | 90e3e2a7778dc0ec5b421e9657ec49936a3cf174 (diff) | |
download | cmake-24fdd51f4503ccee33c07881cc8dd487cdc8b347.tar.gz |
Refactor: Replace CMAKE_CURRENT_LIST_DIR with CMAKE_CURRENT_FUNCTION_LIST_DIR
Some modules define an intermediate global scope visible variables
to access "resource" files from functions.
Now these variables could be eliminated.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/AndroidTestUtilities.cmake | 4 | ||||
-rw-r--r-- | Modules/CMakeAddFortranSubdirectory.cmake | 5 | ||||
-rw-r--r-- | Modules/DeployQt4.cmake | 3 | ||||
-rw-r--r-- | Modules/FetchContent.cmake | 5 | ||||
-rw-r--r-- | Modules/UseJava.cmake | 3 |
5 files changed, 6 insertions, 14 deletions
diff --git a/Modules/AndroidTestUtilities.cmake b/Modules/AndroidTestUtilities.cmake index e333cdbc6a..95e2ef7e94 100644 --- a/Modules/AndroidTestUtilities.cmake +++ b/Modules/AndroidTestUtilities.cmake @@ -76,8 +76,6 @@ Module Functions include(${CMAKE_CURRENT_LIST_DIR}/ExternalData.cmake) -set(_AndroidTestUtilities_SELF_DIR "${CMAKE_CURRENT_LIST_DIR}") - # The parameters to this function should be set to the list of directories, # files, and libraries that need to be installed prior to testing. function(android_add_test_data test_name) @@ -159,6 +157,6 @@ function(android_add_test_data test_name) "-Darg_files=${processed_FILES}" "-Darg_libs=${AST_LIBS}" "-Darg_src_dir=${CMAKE_CURRENT_SOURCE_DIR}" - -P ${_AndroidTestUtilities_SELF_DIR}/AndroidTestUtilities/PushToAndroidDevice.cmake) + -P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/AndroidTestUtilities/PushToAndroidDevice.cmake) endif() endfunction() diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake index 2613569d19..d4b537f67d 100644 --- a/Modules/CMakeAddFortranSubdirectory.cmake +++ b/Modules/CMakeAddFortranSubdirectory.cmake @@ -43,7 +43,6 @@ future version that supports installation of the external project binaries during ``make install``. #]=======================================================================] -set(_MS_MINGW_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}) include(CheckLanguage) include(ExternalProject) @@ -87,11 +86,11 @@ function(_setup_mingw_config_and_build source_dir build_dir) file(TO_NATIVE_PATH "${MINGW_PATH}" MINGW_PATH) string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}") configure_file( - ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/config_mingw.cmake.in + ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/CMakeAddFortranSubdirectory/config_mingw.cmake.in ${build_dir}/config_mingw.cmake @ONLY) configure_file( - ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/build_mingw.cmake.in + ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/CMakeAddFortranSubdirectory/build_mingw.cmake.in ${build_dir}/build_mingw.cmake @ONLY) endfunction() diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index 4a18927c25..9aa43838e5 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -106,7 +106,6 @@ and plugin installation. See documentation of FIXUP_QT4_BUNDLE. # The functions defined in this file depend on the fixup_bundle function # (and others) found in BundleUtilities.cmake -set(DeployQt4_cmake_dir "${CMAKE_CURRENT_LIST_DIR}") set(DeployQt4_apple_plugins_dir "PlugIns") function(write_qt4_conf qt_conf_dir qt_conf_contents) @@ -392,7 +391,7 @@ function(install_qt4_executable executable) resolve_qt4_paths(libs "") install(CODE -"include(\"${DeployQt4_cmake_dir}/DeployQt4.cmake\") +"include(\"${CMAKE_CURRENT_FUNCTION_LIST_DIR}/DeployQt4.cmake\") set(BU_CHMOD_BUNDLE_ITEMS TRUE) FIXUP_QT4_EXECUTABLE(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${executable}\" \"\" \"${libs}\" \"${dirs}\" \"${plugins_dir}\" \"${request_qt_conf}\")" ${component} diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index 5716b0112f..f3e1b51ff9 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -596,9 +596,6 @@ current working directory. #]=======================================================================] - -set(__FetchContent_privateDir "${CMAKE_CURRENT_LIST_DIR}/FetchContent") - #======================================================================= # Recording and retrieving content details for later population #======================================================================= @@ -888,7 +885,7 @@ function(__FetchContent_directPopulate contentName) # anything to be updated, so extra rebuilds of the project won't occur. # Make sure to pass through CMAKE_MAKE_PROGRAM in case the main project # has this set to something not findable on the PATH. - configure_file("${__FetchContent_privateDir}/CMakeLists.cmake.in" + configure_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/FetchContent/CMakeLists.cmake.in" "${ARG_SUBBUILD_DIR}/CMakeLists.txt") execute_process( COMMAND ${CMAKE_COMMAND} ${generatorOpts} . diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 07984885bc..a73fc2a6ef 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -405,7 +405,6 @@ endfunction() # define helper scripts set(_JAVA_EXPORT_TARGETS_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/javaTargets.cmake.in) -set(_JAVA_CLASS_FILELIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaClassFilelist.cmake) set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake) function(add_jar _TARGET_NAME) @@ -627,7 +626,7 @@ function(add_jar _TARGET_NAME) COMMAND ${CMAKE_COMMAND} -DCMAKE_JAVA_CLASS_OUTPUT_PATH=${CMAKE_JAVA_CLASS_OUTPUT_PATH} -DCMAKE_JAR_CLASSES_PREFIX="${CMAKE_JAR_CLASSES_PREFIX}" - -P ${_JAVA_CLASS_FILELIST_SCRIPT} + -P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/UseJavaClassFilelist.cmake DEPENDS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) |