mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 12:49:36 -06:00
Autogen: Skip generated files for compatibility with CMake 3.8
The change in commit v3.9.0-rc1~464^2~8 (Autogen: Add AUTOMOC/UIC support for generated source files, 2017-03-02) changes behavior of existing projects that may not expect `AUTOGEN` on generated files and do not yet set `SKIP_AUTOGEN` on them. Disable the behavior change for now to fix the regression for CMake 3.9. We can restore it later with a policy. In order to keep the implementation and tests working, add an undocumented property we can use in the tests to enable the behavior before the policy is introduced. Fixes: #17031 Issue: #16186
This commit is contained in:
@@ -303,6 +303,13 @@ static void AcquireScanFiles(cmGeneratorTarget const* target,
|
|||||||
!(fileType == cmSystemTools::HEADER_FILE_FORMAT)) {
|
!(fileType == cmSystemTools::HEADER_FILE_FORMAT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (PropertyEnabled(sf, "GENERATED") &&
|
||||||
|
!target->GetPropertyAsBool("__UNDOCUMENTED_AUTOGEN_GENERATED_FILES")) {
|
||||||
|
// FIXME: Add a policy whose NEW behavior allows generated files.
|
||||||
|
// The implementation already works. We disable it here to avoid
|
||||||
|
// changing behavior for existing projects that do not expect it.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const std::string absFile =
|
const std::string absFile =
|
||||||
cmsys::SystemTools::GetRealPath(sf->GetFullPath());
|
cmsys::SystemTools::GetRealPath(sf->GetFullPath());
|
||||||
// Skip flags
|
// Skip flags
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ add_executable(mocDepends1 test1.cpp
|
|||||||
)
|
)
|
||||||
target_link_libraries(mocDepends1 ${QT_CORE_TARGET})
|
target_link_libraries(mocDepends1 ${QT_CORE_TARGET})
|
||||||
set_target_properties(mocDepends1 PROPERTIES AUTOMOC TRUE)
|
set_target_properties(mocDepends1 PROPERTIES AUTOMOC TRUE)
|
||||||
|
set_property(TARGET mocDepends1 PROPERTY __UNDOCUMENTED_AUTOGEN_GENERATED_FILES 1)
|
||||||
|
|
||||||
# -- Test 2 using generated library
|
# -- Test 2 using generated library
|
||||||
# This tests the dependency of AUTOMOC of mocDepends2 to the
|
# This tests the dependency of AUTOMOC of mocDepends2 to the
|
||||||
@@ -43,3 +44,4 @@ add_library(SimpleLib STATIC simpleLib.hpp simpleLib.cpp)
|
|||||||
add_executable(mocDepends2 test2.cpp )
|
add_executable(mocDepends2 test2.cpp )
|
||||||
target_link_libraries(mocDepends2 SimpleLib ${QT_CORE_TARGET})
|
target_link_libraries(mocDepends2 SimpleLib ${QT_CORE_TARGET})
|
||||||
set_target_properties(mocDepends2 PROPERTIES AUTOMOC TRUE)
|
set_target_properties(mocDepends2 PROPERTIES AUTOMOC TRUE)
|
||||||
|
set_property(TARGET mocDepends2 PROPERTY __UNDOCUMENTED_AUTOGEN_GENERATED_FILES 1)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ add_executable(mocRerun
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}/main.cpp
|
${CMAKE_CURRENT_BINARY_DIR}/main.cpp
|
||||||
res1.qrc
|
res1.qrc
|
||||||
)
|
)
|
||||||
|
set_property(TARGET mocRerun PROPERTY __UNDOCUMENTED_AUTOGEN_GENERATED_FILES 1)
|
||||||
target_include_directories(mocRerun PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
target_include_directories(mocRerun PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
target_link_libraries(mocRerun ${QT_CORE_TARGET})
|
target_link_libraries(mocRerun ${QT_CORE_TARGET})
|
||||||
# Write target name to text file
|
# Write target name to text file
|
||||||
|
|||||||
Reference in New Issue
Block a user