Commit 12b999e6 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'autogen-dep-on-imported-implib-only-target' into release-3.21

895fa343 cmQtAutoGenInitializer: support IMPLIB-only imported targets
354c1f56

 Tests/RunCMake/Autogen: test CMP0111 behavior
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Tested-by: buildbot's avatarbuildbot <buildbot@kitware.com>
Merge-request: !6558
parents afd4d252 895fa343
Pipeline #249710 passed with stages
in 65 minutes and 51 seconds
......@@ -1306,7 +1306,16 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
// Add additional autogen target dependencies to
// '_autogen_timestamp_deps'.
for (const cmTarget* t : this->AutogenTarget.DependTargets) {
dependencies.push_back(t->GetName());
std::string depname = t->GetName();
if (t->IsImported()) {
auto ttype = t->GetType();
if (ttype == cmStateEnums::TargetType::STATIC_LIBRARY ||
ttype == cmStateEnums::TargetType::SHARED_LIBRARY ||
ttype == cmStateEnums::TargetType::UNKNOWN_LIBRARY) {
depname = cmStrCat("$<TARGET_LINKER_FILE:", t->GetName(), ">");
}
}
dependencies.push_back(depname);
}
cmTarget* timestampTarget = this->LocalGen->AddUtilityCommand(
......
include("${CMAKE_CURRENT_LIST_DIR}/CMP0111-imported-target-prelude.cmake")
set_location(executable LOCATION "${CMAKE_CURRENT_BINARY_DIR}/executable${CMAKE_EXECUTABLE_SUFFIX}")
set_location(shared LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}shared${CMAKE_SHARED_LIBRARY_SUFFIX}")
if (CMAKE_IMPORT_LIBRARY_SUFFIX)
set_location(shared IMPLIB "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}shared${CMAKE_IMPORT_LIBRARY_SUFFIX}")
endif ()
set_location(static LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}static${CMAKE_STATIC_LIBRARY_SUFFIX}")
set_location(unknown LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}unknown${CMAKE_IMPORT_LIBRARY_SUFFIX}")
set_location(module LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_MODULE_PREFIX}module${CMAKE_SHARED_MODULE_SUFFIX}")
include("${CMAKE_CURRENT_LIST_DIR}/CMP0111-imported-target-prelude.cmake")
set_location(executable LOCATION "${CMAKE_CURRENT_BINARY_DIR}/executable${CMAKE_EXECUTABLE_SUFFIX}")
if (CMAKE_IMPORT_LIBRARY_SUFFIX)
set_location(shared IMPLIB "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}shared${CMAKE_IMPORT_LIBRARY_SUFFIX}")
else ()
set_location(shared LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}shared${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif ()
set_location(static LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}static${CMAKE_STATIC_LIBRARY_SUFFIX}")
set_location(unknown LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}unknown${CMAKE_STATIC_LIBRARY_SUFFIX}")
set_location(module LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_MODULE_PREFIX}module${CMAKE_SHARED_MODULE_SUFFIX}")
include("${CMAKE_CURRENT_LIST_DIR}/CMP0111-imported-target-prelude.cmake")
set_location(executable LOCATION "${CMAKE_CURRENT_BINARY_DIR}/executable${CMAKE_EXECUTABLE_SUFFIX}")
set_location(shared LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}shared${CMAKE_SHARED_LIBRARY_SUFFIX}")
if (CMAKE_IMPORT_LIBRARY_SUFFIX)
set_location(shared IMPLIB "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}shared${CMAKE_IMPORT_LIBRARY_SUFFIX}")
endif ()
set_location(static LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}static${CMAKE_IMPORT_LIBRARY_SUFFIX}")
set_location(unknown LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}unknown${CMAKE_IMPORT_LIBRARY_SUFFIX}")
set_location(module LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_MODULE_PREFIX}module${CMAKE_SHARED_MODULE_SUFFIX}")
set_location(interface LIBNAME "interface")
enable_language(CXX)
find_package(Qt5 REQUIRED COMPONENTS Core)
# Detect `-NOTFOUND` libraries at generate time.
cmake_policy(SET CMP0111 NEW)
add_executable(imported::executable IMPORTED)
add_library(imported::shared SHARED IMPORTED)
add_library(imported::static STATIC IMPORTED)
add_library(imported::unknown UNKNOWN IMPORTED)
add_library(imported::interface INTERFACE IMPORTED)
add_library(imported::module MODULE IMPORTED)
function (set_location target name loc)
set_property(TARGET "imported::${target}" PROPERTY
"IMPORTED_${name}" "${loc}")
endfunction ()
set(CMAKE_AUTOMOC 1)
add_library(automoc
empty.cpp)
target_link_libraries(automoc
PRIVATE
imported::shared
imported::static
imported::unknown
imported::interface)
add_dependencies(automoc
imported::executable
imported::module)
......@@ -5,4 +5,8 @@ if (with_qt5)
run_cmake(QtInFunction)
run_cmake(QtInFunctionNested)
run_cmake(QtInFunctionProperty)
run_cmake(CMP0111-imported-target-full)
run_cmake(CMP0111-imported-target-libname)
run_cmake(CMP0111-imported-target-implib-only)
endif ()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment