From 3ded5b6da8cb10d855e36d4ea534222ba870d165 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 4 Oct 2019 09:23:13 -0400 Subject: install,export: Fix export of a genex following $ The relative path check added by commit 5838aba1aa (Export: Report error on relative include with genex., 2013-11-26, v3.0.0-rc1~285^2) was added one condition too early. If the value starts in `${_IMPORT_PREFIX}` (which comes from `$`) then it is an absolute path. Fixes: #19791 --- Source/cmExportFileGenerator.cxx | 6 +++--- Tests/ExportImport/Export/CMakeLists.txt | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index b968537..3d7eccc 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -216,6 +216,9 @@ static bool checkInterfaceDirs(const std::string& prepro, if (genexPos == 0) { continue; } + if (cmHasLiteralPrefix(li, "${_IMPORT_PREFIX}")) { + continue; + } MessageType messageType = MessageType::FATAL_ERROR; std::ostringstream e; if (genexPos != std::string::npos) { @@ -237,9 +240,6 @@ static bool checkInterfaceDirs(const std::string& prepro, hadFatalError = true; } } - if (cmHasLiteralPrefix(li, "${_IMPORT_PREFIX}")) { - continue; - } if (!cmSystemTools::FileIsFullPath(li)) { /* clang-format off */ e << "Target \"" << target->GetName() << "\" " << prop << diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index c6b7dbc..5cf04e8 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -313,6 +313,8 @@ install(FILES ) cmake_policy(POP) +cmake_policy(PUSH) +cmake_policy(SET CMP0041 NEW) add_library(testSharedLibDepends SHARED testSharedLibDepends.cpp) set_property(TARGET testSharedLibDepends APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}" @@ -329,9 +331,10 @@ install(FILES DESTINATION include/testSharedLibDepends ) set_property(TARGET testSharedLibDepends APPEND PROPERTY - INTERFACE_INCLUDE_DIRECTORIES "$/include/testSharedLibDepends>" + INTERFACE_INCLUDE_DIRECTORIES "$/$<1:include>/testSharedLibDepends>" "$" ) +cmake_policy(POP) # LINK_PRIVATE because the LINK_INTERFACE_LIBRARIES is specified above. target_link_libraries(testSharedLibDepends LINK_PRIVATE testSharedLibRequired) -- cgit v0.12