From 319b59500ce3ab2a528cd53fa13047cf7c915982 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Thu, 25 Apr 2019 19:19:19 +0200 Subject: [PATCH] Convert obsolete uses of get_filename_component( PATH) In the context of get_filename_component(), PATH is a legacy alias for DIRECTORY. Replace it with DIRECTORY, which is recommended[1] for CMake versions > 2.8.11. [1] https://cmake.org/cmake/help/latest/command/get_filename_component.html --- CMakeLists.txt | 4 ++-- CMakeModules/BoostTestTargets.cmake | 2 +- CMakeModules/CopyResourcesToBuildTree.cmake | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a2f59f1..8a48cb4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,7 +150,7 @@ endif() if (MSVC) - GET_FILENAME_COMPONENT(PARENT_DIR ${PROJECT_BINARY_DIR} PATH) + GET_FILENAME_COMPONENT(PARENT_DIR ${PROJECT_BINARY_DIR} DIRECTORY) if (CMAKE_CL_64) SET(TEST_3RDPARTY_DIR "${PARENT_DIR}/3rdparty.x64") else (CMAKE_CL_64) @@ -198,7 +198,7 @@ if (MSVC AND MSVC_3RDPARTY_ROOT) # if this variable was not set by the user, set it to 3rdparty root's # parent dir, which is the normal location for people using our # windows-3rd-party repo - GET_FILENAME_COMPONENT(MSVC_ROOT_PARENT_DIR ${MSVC_3RDPARTY_ROOT} PATH) + get_filename_component(MSVC_ROOT_PARENT_DIR ${MSVC_3RDPARTY_ROOT} DIRECTORY) set(BOOST_INCLUDEDIR ${MSVC_ROOT_PARENT_DIR}) message(STATUS "BOOST_INCLUDEDIR is ${BOOST_INCLUDEDIR}") endif() diff --git a/CMakeModules/BoostTestTargets.cmake b/CMakeModules/BoostTestTargets.cmake index 3da31265..580bf9d2 100644 --- a/CMakeModules/BoostTestTargets.cmake +++ b/CMakeModules/BoostTestTargets.cmake @@ -80,7 +80,7 @@ if(Boost_FOUND AND NOT "${Boost_VERSION}0" LESS "1034000") set(_boostConfig "BoostTestTargetsDynamic.h") endif() endif() - get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} PATH) + get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} DIRECTORY) configure_file("${_moddir}/${_boostConfig}" "${CMAKE_CURRENT_BINARY_DIR}/BoostTestTargetConfig.h" COPYONLY) diff --git a/CMakeModules/CopyResourcesToBuildTree.cmake b/CMakeModules/CopyResourcesToBuildTree.cmake index 3512cc48..0593363d 100644 --- a/CMakeModules/CopyResourcesToBuildTree.cmake +++ b/CMakeModules/CopyResourcesToBuildTree.cmake @@ -30,12 +30,12 @@ function(copy_resources_to_build_tree _target) endif() get_target_property(_path ${_target} LOCATION) - get_filename_component(_path "${_path}" PATH) + get_filename_component(_path "${_path}" DIRECTORY) if(NOT MSVC AND NOT "${CMAKE_GENERATOR}" MATCHES "Makefiles") foreach(_config ${CMAKE_CONFIGURATION_TYPES}) get_target_property(_path${_config} ${_target} LOCATION_${_config}) - get_filename_component(_path${_config} "${_path${_config}}" PATH) + get_filename_component(_path${_config} "${_path${_config}}" DIRECTORY) add_custom_command(TARGET ${_target} POST_BUILD COMMAND