From 08db1341a60035b303a20eb3f23126a661323c27 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Mon, 3 May 2021 14:16:07 +0200 Subject: find_*: ensure consistent behavior for cache variables Fixes: #22121 --- Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0125.rst | 25 ++++++++++ Help/release/dev/find_item-consistent-behavior.rst | 6 +++ Source/cmFindBase.cxx | 58 ++++++++++++++++++---- Source/cmMakefile.cxx | 2 + Source/cmPolicies.h | 6 ++- .../CMP0125/CMP0125-find_file-Common.cmake | 51 +++++++++++++++++++ .../CMP0125/CMP0125-find_file-NEW-stderr.txt | 14 ++++++ Tests/RunCMake/CMP0125/CMP0125-find_file-NEW.cmake | 4 ++ .../CMP0125/CMP0125-find_file-OLD-stderr.txt | 14 ++++++ Tests/RunCMake/CMP0125/CMP0125-find_file-OLD.cmake | 4 ++ .../CMP0125/CMP0125-find_library-Common.cmake | 52 +++++++++++++++++++ .../CMP0125/CMP0125-find_library-NEW-stderr.txt | 14 ++++++ .../CMP0125/CMP0125-find_library-NEW.cmake | 6 +++ .../CMP0125/CMP0125-find_library-OLD-stderr.txt | 14 ++++++ .../CMP0125/CMP0125-find_library-OLD.cmake | 6 +++ .../CMP0125/CMP0125-find_path-Common.cmake | 51 +++++++++++++++++++ .../CMP0125/CMP0125-find_path-NEW-stderr.txt | 14 ++++++ Tests/RunCMake/CMP0125/CMP0125-find_path-NEW.cmake | 4 ++ .../CMP0125/CMP0125-find_path-OLD-stderr.txt | 14 ++++++ Tests/RunCMake/CMP0125/CMP0125-find_path-OLD.cmake | 4 ++ .../CMP0125/CMP0125-find_program-Common.cmake | 52 +++++++++++++++++++ .../CMP0125/CMP0125-find_program-NEW-stderr.txt | 14 ++++++ .../CMP0125/CMP0125-find_program-NEW.cmake | 4 ++ .../CMP0125/CMP0125-find_program-OLD-stderr.txt | 14 ++++++ .../CMP0125/CMP0125-find_program-OLD.cmake | 4 ++ Tests/RunCMake/CMP0125/CMakeLists.txt | 3 ++ Tests/RunCMake/CMP0125/RunCMakeTest.cmake | 36 ++++++++++++++ Tests/RunCMake/CMakeLists.txt | 4 ++ 29 files changed, 485 insertions(+), 10 deletions(-) create mode 100644 Help/policy/CMP0125.rst create mode 100644 Help/release/dev/find_item-consistent-behavior.rst create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_file-Common.cmake create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_file-NEW-stderr.txt create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_file-NEW.cmake create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_file-OLD-stderr.txt create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_file-OLD.cmake create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_library-Common.cmake create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_library-NEW-stderr.txt create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_library-NEW.cmake create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_library-OLD-stderr.txt create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_library-OLD.cmake create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_path-Common.cmake create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_path-NEW-stderr.txt create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_path-NEW.cmake create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_path-OLD-stderr.txt create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_path-OLD.cmake create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_program-Common.cmake create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_program-NEW-stderr.txt create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_program-NEW.cmake create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_program-OLD-stderr.txt create mode 100644 Tests/RunCMake/CMP0125/CMP0125-find_program-OLD.cmake create mode 100644 Tests/RunCMake/CMP0125/CMakeLists.txt create mode 100644 Tests/RunCMake/CMP0125/RunCMakeTest.cmake diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index a480473..62ccb01 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,7 @@ Policies Introduced by CMake 3.21 .. toctree:: :maxdepth: 1 + CMP0125: find_(path|file|library|program) have consistent behavior for cache variables. CMP0124: foreach() loop variables are only available in the loop scope. CMP0123: ARMClang cpu/arch compile and link flags must be set explicitly. CMP0122: UseSWIG use standard library name conventions for csharp language. diff --git a/Help/policy/CMP0125.rst b/Help/policy/CMP0125.rst new file mode 100644 index 0000000..19571dc --- /dev/null +++ b/Help/policy/CMP0125.rst @@ -0,0 +1,25 @@ +CMP0125 +------- + +.. versionadded:: 3.21 + +The :command:`find_file`, :command:`find_path`, :command:`find_library` and +:command:`find_program` commands handle cache variables in the same way +regardless of whether they are defined on the command line, with or without a +type, or using the :command:`set` command. + +Starting with CMake 3.21, the :command:`find_file`, :command:`find_path`, +:command:`find_library`, and :command:`find_program` commands ensure that the +cache variables will be used in the same way regardless how they were defined +and the result will be always successful if the searched artifact exists. + +The ``OLD`` behavior for this policy is to have the find commands' behaviors +differ depending on how the cache variable is defined. The ``NEW`` behavior for +this policy is to have consistent behavior. + +This policy was introduced in CMake version 3.21. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. +Unlike many policies, CMake version |release| does *not* warn when the policy +is not set and simply uses ``OLD`` behavior. + +.. include:: DEPRECATED.txt diff --git a/Help/release/dev/find_item-consistent-behavior.rst b/Help/release/dev/find_item-consistent-behavior.rst new file mode 100644 index 0000000..43905e7 --- /dev/null +++ b/Help/release/dev/find_item-consistent-behavior.rst @@ -0,0 +1,6 @@ +find_item-consistent-behavior +----------------------------- + +* The :command:`find_file`, :command:`find_path`, :command:`find_program`, + and :command:`find_library` commands handle cache variables in the same way + regardless how they are defined. See policy :policy:`CMP0125` for details. diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 409e2e0..6296d06 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -9,8 +9,10 @@ #include +#include "cmCMakePath.h" #include "cmMakefile.h" #include "cmMessageType.h" +#include "cmPolicies.h" #include "cmProperty.h" #include "cmRange.h" #include "cmSearchPath.h" @@ -18,6 +20,7 @@ #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" +#include "cmake.h" class cmExecutionStatus; @@ -328,28 +331,65 @@ bool cmFindBase::CheckForVariableInCache() void cmFindBase::NormalizeFindResult() { - // If the user specifies the entry on the command line without a - // type we should add the type and docstring but keep the original - // value. - if (this->AlreadyInCacheWithoutMetaInfo) { - this->Makefile->AddCacheDefinition(this->VariableName, "", - this->VariableDocumentation.c_str(), - this->VariableType); + if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0125) == + cmPolicies::NEW) { + // ensure the path returned by find_* command is absolute + const auto* existingValue = + this->Makefile->GetDefinition(this->VariableName); + std::string value; + if (!existingValue->empty()) { + value = + cmCMakePath(*existingValue, cmCMakePath::auto_format) + .Absolute(cmCMakePath( + this->Makefile->GetCMakeInstance()->GetCMakeWorkingDirectory())) + .Normal() + .GenericString(); + // value = cmSystemTools::CollapseFullPath(*existingValue); + if (!cmSystemTools::FileExists(value, false)) { + value = *existingValue; + } + } + + // If the user specifies the entry on the command line without a + // type we should add the type and docstring but keep the original + // value. + if (value != *existingValue || this->AlreadyInCacheWithoutMetaInfo) { + this->Makefile->GetCMakeInstance()->AddCacheEntry( + this->VariableName, value.c_str(), this->VariableDocumentation.c_str(), + this->VariableType); + // if there was a definition then remove it + // This is required to ensure same behavior as + // cmMakefile::AddCacheDefinition. + // See #22038 for problems raised by this behavior. + this->Makefile->RemoveDefinition(this->VariableName); + } + } else { + // If the user specifies the entry on the command line without a + // type we should add the type and docstring but keep the original + // value. + if (this->AlreadyInCacheWithoutMetaInfo) { + this->Makefile->AddCacheDefinition(this->VariableName, "", + this->VariableDocumentation.c_str(), + this->VariableType); + } } } void cmFindBase::StoreFindResult(const std::string& value) { + bool force = + this->Makefile->GetPolicyStatus(cmPolicies::CMP0125) == cmPolicies::NEW; + if (!value.empty()) { this->Makefile->AddCacheDefinition(this->VariableName, value, this->VariableDocumentation.c_str(), - this->VariableType); + this->VariableType, force); return; } this->Makefile->AddCacheDefinition( this->VariableName, cmStrCat(this->VariableName, "-NOTFOUND"), - this->VariableDocumentation.c_str(), this->VariableType); + this->VariableDocumentation.c_str(), this->VariableType, force); if (this->Required) { this->Makefile->IssueMessage( diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5a37bb9..f7e81bc 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1963,6 +1963,8 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, } this->GetCMakeInstance()->AddCacheEntry(name, value, doc, type); // if there was a definition then remove it + // The method cmFindBase::NormalizeFindResult also apply same workflow. + // See #22038 for problems raised by this behavior. this->StateSnapshot.RemoveDefinition(name); } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 0ff12d5..3ebb17d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -372,7 +372,11 @@ class cmMakefile; 3, 21, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0124, \ "foreach() loop variables are only available in the loop scope.", 3, \ - 21, 0, cmPolicies::WARN) + 21, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0125, \ + "find_(path|file|library|program) have consistent behavior for " \ + "cache variables.", \ + 3, 21, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_file-Common.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_file-Common.cmake new file mode 100644 index 0000000..a85978b --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_file-Common.cmake @@ -0,0 +1,51 @@ + +find_file(RELATIVE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_file(RELATIVE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_file(ABSOLUTE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_file(ABSOLUTE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_file(NOTFOUND_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_file(NOTFOUND_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +file(WRITE "${CMAKE_BINARY_DIR}/${FILE_NAME}" "") +find_file(FILE_NAME NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_file(FILE_NAME_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH=${RELATIVE_PATH}") +message("RELATIVE_PATH_WITH_TYPE=${RELATIVE_PATH_WITH_TYPE}") + +message("ABSOLUTE_PATH=${ABSOLUTE_PATH}") +message("ABSOLUTE_PATH_WITH_TYPE=${ABSOLUTE_PATH_WITH_TYPE}") + +message("NOTFOUND_PATH=${NOTFOUND_PATH}") +message("NOTFOUND_PATH_WITH_TYPE=${NOTFOUND_PATH_WITH_TYPE}") + +message("FILE_NAME=${FILE_NAME}") +message("FILE_NAME_WITH_TYPE=${FILE_NAME_WITH_TYPE}") + + +set(RELATIVE_PATH_AND_LOCAL relative_local) +set(RELATIVE_PATH_WITH_TYPE_AND_LOCAL relative_local) +set(ABSOLUTE_PATH_AND_LOCAL /absolute_local) +set(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL /absolute_local) +set(NOTFOUND_AND_LOCAL "${FILE_NAME}") +set(NOTFOUND_WITH_TYPE_AND_LOCAL "${FILE_NAME}") + +find_file(RELATIVE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_file(RELATIVE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_file(ABSOLUTE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_file(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_file(NOTFOUND_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_file(NOTFOUND_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH_AND_LOCAL=${RELATIVE_PATH_AND_LOCAL}") +message("RELATIVE_PATH_WITH_TYPE_AND_LOCAL=${RELATIVE_PATH_WITH_TYPE_AND_LOCAL}") + +message("ABSOLUTE_PATH_AND_LOCAL=${ABSOLUTE_PATH_AND_LOCAL}") +message("ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=${ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL}") + +message("NOTFOUND_PATH_AND_LOCAL=${NOTFOUND_PATH_AND_LOCAL}") +message("NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=${NOTFOUND_PATH_WITH_TYPE_AND_LOCAL}") diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_file-NEW-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_file-NEW-stderr.txt new file mode 100644 index 0000000..10f95bc --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_file-NEW-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=/.+/CMP0125/file\.txt +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125/file\.txt +FILE_NAME=/.+/CMP0125/CMP0125-find_file-NEW-build/file2\.txt +FILE_NAME_WITH_TYPE=/.+/CMP0125/CMP0125-find_file-NEW-build/file2\.txt +RELATIVE_PATH_AND_LOCAL=relative_local +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute_local +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=/.+/CMP0125/file.txt +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125/file.txt diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_file-NEW.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_file-NEW.cmake new file mode 100644 index 0000000..4f04834 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_file-NEW.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0125 NEW) + +include(CMP0125-find_file-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_file-OLD-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_file-OLD-stderr.txt new file mode 100644 index 0000000..5b25f92 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_file-OLD-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=/.+/CMP0125/CMP0125-find_file-OLD-build/relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=NOTFOUND +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125/file\.txt +FILE_NAME=/.+/CMP0125/CMP0125-find_file-OLD-build/file2\.txt +FILE_NAME_WITH_TYPE=file2\.txt +RELATIVE_PATH_AND_LOCAL=/.+/CMP0125/CMP0125-find_file-OLD-build/relative +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=NOTFOUND +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125/file\.txt diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_file-OLD.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_file-OLD.cmake new file mode 100644 index 0000000..21884b5 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_file-OLD.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0125 OLD) + +include(CMP0125-find_file-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_library-Common.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_library-Common.cmake new file mode 100644 index 0000000..d2bc006 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_library-Common.cmake @@ -0,0 +1,52 @@ + +find_library(RELATIVE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_library(RELATIVE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_library(ABSOLUTE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_library(ABSOLUTE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_library(NOTFOUND_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_library(NOTFOUND_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +file(WRITE "${CMAKE_BINARY_DIR}/${FILE_NAME}" "") +file(CHMOD "${CMAKE_BINARY_DIR}/${FILE_NAME}" PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE) +find_library(FILE_NAME NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_library(FILE_NAME_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH=${RELATIVE_PATH}") +message("RELATIVE_PATH_WITH_TYPE=${RELATIVE_PATH_WITH_TYPE}") + +message("ABSOLUTE_PATH=${ABSOLUTE_PATH}") +message("ABSOLUTE_PATH_WITH_TYPE=${ABSOLUTE_PATH_WITH_TYPE}") + +message("NOTFOUND_PATH=${NOTFOUND_PATH}") +message("NOTFOUND_PATH_WITH_TYPE=${NOTFOUND_PATH_WITH_TYPE}") + +message("FILE_NAME=${FILE_NAME}") +message("FILE_NAME_WITH_TYPE=${FILE_NAME_WITH_TYPE}") + + +set(RELATIVE_PATH_AND_LOCAL relative_local) +set(RELATIVE_PATH_WITH_TYPE_AND_LOCAL relative_local) +set(ABSOLUTE_PATH_AND_LOCAL /absolute_local) +set(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL /absolute_local) +set(NOTFOUND_AND_LOCAL "${FILE_NAME}") +set(NOTFOUND_WITH_TYPE_AND_LOCAL "${FILE_NAME}") + +find_library(RELATIVE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_library(RELATIVE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_library(ABSOLUTE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_library(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_library(NOTFOUND_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_library(NOTFOUND_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH_AND_LOCAL=${RELATIVE_PATH_AND_LOCAL}") +message("RELATIVE_PATH_WITH_TYPE_AND_LOCAL=${RELATIVE_PATH_WITH_TYPE_AND_LOCAL}") + +message("ABSOLUTE_PATH_AND_LOCAL=${ABSOLUTE_PATH_AND_LOCAL}") +message("ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=${ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL}") + +message("NOTFOUND_PATH_AND_LOCAL=${NOTFOUND_PATH_AND_LOCAL}") +message("NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=${NOTFOUND_PATH_WITH_TYPE_AND_LOCAL}") diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_library-NEW-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_library-NEW-stderr.txt new file mode 100644 index 0000000..d180833 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_library-NEW-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=/.+/CMP0125/libfile\.(so|dylib) +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125/libfile\.(so|dylib) +FILE_NAME=/.+/CMP0125/CMP0125-find_library-NEW-build/libfile2\.(so|dylib) +FILE_NAME_WITH_TYPE=/.+/CMP0125/CMP0125-find_library-NEW-build/libfile2\.(so|dylib) +RELATIVE_PATH_AND_LOCAL=relative_local +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute_local +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=/.+/CMP0125/libfile.(so|dylib) +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125/libfile.(so|dylib) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_library-NEW.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_library-NEW.cmake new file mode 100644 index 0000000..31f5441 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_library-NEW.cmake @@ -0,0 +1,6 @@ + +cmake_policy(SET CMP0125 NEW) + +enable_language(C) + +include(CMP0125-find_library-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_library-OLD-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_library-OLD-stderr.txt new file mode 100644 index 0000000..cd3af56 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_library-OLD-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=/.+/CMP0125/CMP0125-find_library-OLD-build/relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=NOTFOUND +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125/libfile\.(so|dylib) +FILE_NAME=/.+/CMP0125/CMP0125-find_library-OLD-build/libfile2\.(so|dylib) +FILE_NAME_WITH_TYPE=libfile2\.(so|dylib) +RELATIVE_PATH_AND_LOCAL=relative_local +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute_local +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=/.+/CMP0125/libfile\.(so|dylib) +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125/libfile\.(so|dylib) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_library-OLD.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_library-OLD.cmake new file mode 100644 index 0000000..1dc4a95 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_library-OLD.cmake @@ -0,0 +1,6 @@ + +cmake_policy(SET CMP0125 OLD) + +enable_language(C) + +include(CMP0125-find_library-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_path-Common.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_path-Common.cmake new file mode 100644 index 0000000..37680c2 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_path-Common.cmake @@ -0,0 +1,51 @@ + +find_path(RELATIVE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_path(RELATIVE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_path(ABSOLUTE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_path(ABSOLUTE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_path(NOTFOUND_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_path(NOTFOUND_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +file(WRITE "${CMAKE_BINARY_DIR}/${FILE_NAME}" "") +find_path(FILE_NAME NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_path(FILE_NAME_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH=${RELATIVE_PATH}") +message("RELATIVE_PATH_WITH_TYPE=${RELATIVE_PATH_WITH_TYPE}") + +message("ABSOLUTE_PATH=${ABSOLUTE_PATH}") +message("ABSOLUTE_PATH_WITH_TYPE=${ABSOLUTE_PATH_WITH_TYPE}") + +message("NOTFOUND_PATH=${NOTFOUND_PATH}") +message("NOTFOUND_PATH_WITH_TYPE=${NOTFOUND_PATH_WITH_TYPE}") + +message("FILE_NAME=${FILE_NAME}") +message("FILE_NAME_WITH_TYPE=${FILE_NAME_WITH_TYPE}") + + +set(RELATIVE_PATH_AND_LOCAL relative_local) +set(RELATIVE_PATH_WITH_TYPE_AND_LOCAL relative_local) +set(ABSOLUTE_PATH_AND_LOCAL /absolute_local) +set(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL /absolute_local) +set(NOTFOUND_AND_LOCAL "${FILE_NAME}") +set(NOTFOUND_WITH_TYPE_AND_LOCAL "${FILE_NAME}") + +find_path(RELATIVE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_path(RELATIVE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_path(ABSOLUTE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_path(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_path(NOTFOUND_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_path(NOTFOUND_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH_AND_LOCAL=${RELATIVE_PATH_AND_LOCAL}") +message("RELATIVE_PATH_WITH_TYPE_AND_LOCAL=${RELATIVE_PATH_WITH_TYPE_AND_LOCAL}") + +message("ABSOLUTE_PATH_AND_LOCAL=${ABSOLUTE_PATH_AND_LOCAL}") +message("ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=${ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL}") + +message("NOTFOUND_PATH_AND_LOCAL=${NOTFOUND_PATH_AND_LOCAL}") +message("NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=${NOTFOUND_PATH_WITH_TYPE_AND_LOCAL}") diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_path-NEW-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_path-NEW-stderr.txt new file mode 100644 index 0000000..c3f0208 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_path-NEW-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=/.+/CMP0125 +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125 +FILE_NAME=/.+/CMP0125/CMP0125-find_path-NEW-build/file2\.txt +FILE_NAME_WITH_TYPE=/.+/CMP0125/CMP0125-find_path-NEW-build/file2\.txt +RELATIVE_PATH_AND_LOCAL=relative_local +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute_local +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=/.+/CMP0125 +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125 diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_path-NEW.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_path-NEW.cmake new file mode 100644 index 0000000..d6a8544 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_path-NEW.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0125 NEW) + +include(CMP0125-find_path-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_path-OLD-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_path-OLD-stderr.txt new file mode 100644 index 0000000..b84c869 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_path-OLD-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=/.+/CMP0125/CMP0125-find_path-OLD-build/relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=NOTFOUND +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125 +FILE_NAME=/.+/CMP0125/CMP0125-find_path-OLD-build/file2\.txt +FILE_NAME_WITH_TYPE=file2\.txt +RELATIVE_PATH_AND_LOCAL=/.+/CMP0125/CMP0125-find_path-OLD-build/relative +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=NOTFOUND +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125 diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_path-OLD.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_path-OLD.cmake new file mode 100644 index 0000000..2e98ded --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_path-OLD.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0125 OLD) + +include(CMP0125-find_path-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_program-Common.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_program-Common.cmake new file mode 100644 index 0000000..fee4c34 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_program-Common.cmake @@ -0,0 +1,52 @@ + +find_program(RELATIVE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_program(RELATIVE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_program(ABSOLUTE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_program(ABSOLUTE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_program(NOTFOUND_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_program(NOTFOUND_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +file(WRITE "${CMAKE_BINARY_DIR}/${FILE_NAME}" "") +file(CHMOD "${CMAKE_BINARY_DIR}/${FILE_NAME}" PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE) +find_program(FILE_NAME NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_program(FILE_NAME_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH=${RELATIVE_PATH}") +message("RELATIVE_PATH_WITH_TYPE=${RELATIVE_PATH_WITH_TYPE}") + +message("ABSOLUTE_PATH=${ABSOLUTE_PATH}") +message("ABSOLUTE_PATH_WITH_TYPE=${ABSOLUTE_PATH_WITH_TYPE}") + +message("NOTFOUND_PATH=${NOTFOUND_PATH}") +message("NOTFOUND_PATH_WITH_TYPE=${NOTFOUND_PATH_WITH_TYPE}") + +message("FILE_NAME=${FILE_NAME}") +message("FILE_NAME_WITH_TYPE=${FILE_NAME_WITH_TYPE}") + + +set(RELATIVE_PATH_AND_LOCAL relative_local) +set(RELATIVE_PATH_WITH_TYPE_AND_LOCAL relative_local) +set(ABSOLUTE_PATH_AND_LOCAL /absolute_local) +set(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL /absolute_local) +set(NOTFOUND_AND_LOCAL "${FILE_NAME}") +set(NOTFOUND_WITH_TYPE_AND_LOCAL "${FILE_NAME}") + +find_program(RELATIVE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_program(RELATIVE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_program(ABSOLUTE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_program(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_program(NOTFOUND_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_program(NOTFOUND_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH_AND_LOCAL=${RELATIVE_PATH_AND_LOCAL}") +message("RELATIVE_PATH_WITH_TYPE_AND_LOCAL=${RELATIVE_PATH_WITH_TYPE_AND_LOCAL}") + +message("ABSOLUTE_PATH_AND_LOCAL=${ABSOLUTE_PATH_AND_LOCAL}") +message("ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=${ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL}") + +message("NOTFOUND_PATH_AND_LOCAL=${NOTFOUND_PATH_AND_LOCAL}") +message("NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=${NOTFOUND_PATH_WITH_TYPE_AND_LOCAL}") diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_program-NEW-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_program-NEW-stderr.txt new file mode 100644 index 0000000..62da5bf --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_program-NEW-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=/.+/CMP0125/file\.txt +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125/file\.txt +FILE_NAME=/.+/CMP0125/CMP0125-find_program-NEW-build/file2\.txt +FILE_NAME_WITH_TYPE=/.+/CMP0125/CMP0125-find_program-NEW-build/file2\.txt +RELATIVE_PATH_AND_LOCAL=relative_local +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute_local +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=/.+/CMP0125/file.txt +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125/file.txt diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_program-NEW.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_program-NEW.cmake new file mode 100644 index 0000000..c02f23b --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_program-NEW.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0125 NEW) + +include(CMP0125-find_program-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_program-OLD-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_program-OLD-stderr.txt new file mode 100644 index 0000000..a97fc07 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_program-OLD-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=/.+/CMP0125/CMP0125-find_program-OLD-build/relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=NOTFOUND +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125/file\.txt +FILE_NAME=/.+/CMP0125/CMP0125-find_program-OLD-build/file2\.txt +FILE_NAME_WITH_TYPE=file2\.txt +RELATIVE_PATH_AND_LOCAL=/.+/CMP0125/CMP0125-find_program-OLD-build/relative +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=NOTFOUND +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125/file.txt diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_program-OLD.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_program-OLD.cmake new file mode 100644 index 0000000..6be8534 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_program-OLD.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0125 OLD) + +include(CMP0125-find_program-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMakeLists.txt b/Tests/RunCMake/CMP0125/CMakeLists.txt new file mode 100644 index 0000000..7cabeb6 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.20) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0125/RunCMakeTest.cmake b/Tests/RunCMake/CMP0125/RunCMakeTest.cmake new file mode 100644 index 0000000..56d4c86 --- /dev/null +++ b/Tests/RunCMake/CMP0125/RunCMakeTest.cmake @@ -0,0 +1,36 @@ +include(RunCMake) + +file(WRITE "${RunCMake_BINARY_DIR}/file.txt" "") +file(CHMOD "${RunCMake_BINARY_DIR}/file.txt" PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE) + +set(options -DRELATIVE_PATH=relative -DABSOLUTE_PATH=/absolute + -DRELATIVE_PATH_WITH_TYPE:PATH=relative -DABSOLUTE_PATH_WITH_TYPE:PATH=/absolute + -DNOTFOUND_PATH=NOTFOUND -DNOTFOUND_PATH_WITH_TYPE:PATH=NOTFOUND + -DFILE_NAME=file2.txt -DFILE_NAME_WITH_TYPE:PATH=file2.txt + -DSEARCH_NAME=file.txt "-DSEARCH_PATH=${RunCMake_BINARY_DIR}" + -DRELATIVE_PATH_AND_LOCAL=relative -DABSOLUTE_PATH_AND_LOCAL=/absolute + -DRELATIVE_PATH_WITH_TYPE_AND_LOCAL:PATH=relative -DABSOLUTE_PATH_WITH_TYPE_AND_LOCAL:PATH=/absolute + -DNOTFOUND_PATH_AND_LOCAL=NOTFOUND -DNOTFOUND_PATH_WITH_TYPE_AND_LOCAL:PATH=NOTFOUND + -DFILE_NAME=file2.txt -DFILE_NAME_WITH_TYPE:PATH=file2.txt + -DSEARCH_NAME=file.txt "-DSEARCH_PATH=${RunCMake_BINARY_DIR}") + +run_cmake_with_options(CMP0125-find_file-OLD ${options}) +run_cmake_with_options(CMP0125-find_file-NEW ${options}) +run_cmake_with_options(CMP0125-find_path-OLD ${options}) +run_cmake_with_options(CMP0125-find_path-NEW ${options}) +run_cmake_with_options(CMP0125-find_program-OLD ${options}) +run_cmake_with_options(CMP0125-find_program-NEW ${options}) + + +file(WRITE "${RunCMake_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}file${CMAKE_SHARED_LIBRARY_SUFFIX}" "") +file(CHMOD "${RunCMake_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}file${CMAKE_SHARED_LIBRARY_SUFFIX}" PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE) + +set(options -DRELATIVE_PATH=relative -DABSOLUTE_PATH=/absolute + -DRELATIVE_PATH_WITH_TYPE:PATH=relative -DABSOLUTE_PATH_WITH_TYPE:PATH=/absolute + -DNOTFOUND_PATH=NOTFOUND -DNOTFOUND_PATH_WITH_TYPE:PATH=NOTFOUND + -DFILE_NAME=${CMAKE_SHARED_LIBRARY_PREFIX}file2${CMAKE_SHARED_LIBRARY_SUFFIX} + -DFILE_NAME_WITH_TYPE:PATH=${CMAKE_SHARED_LIBRARY_PREFIX}file2${CMAKE_SHARED_LIBRARY_SUFFIX} + -DSEARCH_NAME=file "-DSEARCH_PATH=${RunCMake_BINARY_DIR}") + +run_cmake_with_options(CMP0125-find_library-OLD ${options}) +run_cmake_with_options(CMP0125-find_library-NEW ${options}) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 9bc4131..afaeaef 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -136,6 +136,10 @@ endif() add_RunCMake_test(CMP0118) add_RunCMake_test(CMP0119 -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) add_RunCMake_test(CMP0121) +if (CMAKE_SYSTEM_NAME MATCHES "(Linux|Darwin)") + add_RunCMake_test(CMP0125 -DCMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX} + -DCMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX}) +endif() # The test for Policy 65 requires the use of the # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode -- cgit v0.12