mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-25 10:18:34 -06:00
Merge topic 'autogen-makefile-depfile'
d0bedb2170Autogen: Forward dependencies when both Makefile and DEPFILE are used4deb9c41b8cmQtAutoGenInitializer: Improve Const-correctness Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9190
This commit is contained in:
@@ -72,7 +72,7 @@ unsigned int GetParallelCPUCount()
|
||||
return count;
|
||||
}
|
||||
|
||||
std::string FileProjectRelativePath(cmMakefile* makefile,
|
||||
std::string FileProjectRelativePath(cmMakefile const* makefile,
|
||||
std::string const& fileName)
|
||||
{
|
||||
std::string res;
|
||||
@@ -1462,7 +1462,6 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
std::vector<std::string> dependencies(
|
||||
this->AutogenTarget.DependFiles.begin(),
|
||||
this->AutogenTarget.DependFiles.end());
|
||||
|
||||
if (useDepfile) {
|
||||
// Create a custom command that generates a timestamp file and
|
||||
// has a depfile assigned. The depfile is created by JobDepFilesMergeT.
|
||||
@@ -1501,6 +1500,16 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
cc->SetEscapeOldStyle(false);
|
||||
cmTarget* timestampTarget = this->LocalGen->AddUtilityCommand(
|
||||
timestampTargetName, true, std::move(cc));
|
||||
auto const isMake =
|
||||
this->GlobalGen->GetName().find("Make") != std::string::npos;
|
||||
if (this->AutogenTarget.DependOrigin && isMake) {
|
||||
for (BT<std::pair<std::string, bool>> const& depName :
|
||||
this->GenTarget->GetUtilities()) {
|
||||
timestampTarget->AddUtility(depName.Value.first, false,
|
||||
this->Makefile);
|
||||
}
|
||||
}
|
||||
|
||||
this->LocalGen->AddGeneratorTarget(
|
||||
cm::make_unique<cmGeneratorTarget>(timestampTarget, this->LocalGen));
|
||||
|
||||
|
||||
11
Tests/QtAutogen/AutogenTimestampDeps/CMakeLists.txt
Normal file
11
Tests/QtAutogen/AutogenTimestampDeps/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(AutogenTimestampDeps)
|
||||
include("../AutogenCoreTest.cmake")
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
add_custom_target(ProjectInfo
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/UpdateProjectInfo.cmake
|
||||
BYPRODUCTS ${CMAKE_BINARY_DIR}/ProjectInfo.hpp)
|
||||
|
||||
add_subdirectory(src)
|
||||
6
Tests/QtAutogen/AutogenTimestampDeps/ProjectInfo.hpp.in
Normal file
6
Tests/QtAutogen/AutogenTimestampDeps/ProjectInfo.hpp.in
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef PROJECTINFO_HPP
|
||||
#define PROJECTINFO_HPP
|
||||
|
||||
extern int VersionMajor;
|
||||
|
||||
#endif // PROJECTINFO_HPP
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/../ProjectInfo.hpp.in ${CMAKE_BINARY_DIR}/ProjectInfo.hpp @ONLY)
|
||||
4
Tests/QtAutogen/AutogenTimestampDeps/src/CMakeLists.txt
Normal file
4
Tests/QtAutogen/AutogenTimestampDeps/src/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
add_executable(Exe main.cpp ${CMAKE_BINARY_DIR}/ProjectInfo.hpp)
|
||||
add_dependencies(Exe ProjectInfo)
|
||||
target_include_directories(Exe PRIVATE ${CMAKE_BINARY_DIR})
|
||||
target_link_libraries(Exe PRIVATE ${QT_QTCORE_TARGET})
|
||||
5
Tests/QtAutogen/AutogenTimestampDeps/src/main.cpp
Normal file
5
Tests/QtAutogen/AutogenTimestampDeps/src/main.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "ProjectInfo.hpp"
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
ADD_AUTOGEN_TEST(AutogenOriginDependsOff autogenOriginDependsOff)
|
||||
ADD_AUTOGEN_TEST(AutogenOriginDependsOn)
|
||||
ADD_AUTOGEN_TEST(AutogenTargetDepends)
|
||||
ADD_AUTOGEN_TEST(AutogenTimestampDeps)
|
||||
ADD_AUTOGEN_TEST(AutoMocGeneratedFile)
|
||||
ADD_AUTOGEN_TEST(Complex QtAutogen)
|
||||
ADD_AUTOGEN_TEST(GlobalAutogenSystemUseInclude)
|
||||
|
||||
Reference in New Issue
Block a user