Merge topic 'AutomocProperCMakeEscaping_13018'
9b32475 automoc: add define to test which caused bug #13018 2066511 automoc: fix #13018, proper cmake escaping to avoid false rebuilds c652812 make cmLocalGenerator::EscapeForCMake() static
This commit is contained in:
commit
a3b7caaf5f
@ -1,9 +1,9 @@
|
|||||||
set(AM_SOURCES "@_moc_files@" )
|
set(AM_SOURCES @_moc_files@ )
|
||||||
set(AM_HEADERS "@_moc_headers@" )
|
set(AM_HEADERS @_moc_headers@ )
|
||||||
set(AM_MOC_COMPILE_DEFINITIONS "@_moc_compile_defs@")
|
set(AM_MOC_COMPILE_DEFINITIONS @_moc_compile_defs@)
|
||||||
set(AM_MOC_DEFINITIONS "@_moc_defs@")
|
set(AM_MOC_DEFINITIONS @_moc_defs@)
|
||||||
set(AM_MOC_INCLUDES "@_moc_incs@")
|
set(AM_MOC_INCLUDES @_moc_incs@)
|
||||||
set(AM_MOC_OPTIONS "@_moc_options@")
|
set(AM_MOC_OPTIONS @_moc_options@)
|
||||||
set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@")
|
set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@")
|
||||||
set(AM_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@/")
|
set(AM_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@/")
|
||||||
set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/")
|
set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/")
|
||||||
@ -12,5 +12,5 @@ set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/")
|
|||||||
set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
|
set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
|
||||||
set(AM_QT_VERSION_MAJOR "@QT_VERSION_MAJOR@" )
|
set(AM_QT_VERSION_MAJOR "@QT_VERSION_MAJOR@" )
|
||||||
set(AM_Qt5Core_VERSION_MAJOR "@Qt5Core_VERSION_MAJOR@" )
|
set(AM_Qt5Core_VERSION_MAJOR "@Qt5Core_VERSION_MAJOR@" )
|
||||||
set(AM_TARGET_NAME "@_moc_target_name@")
|
set(AM_TARGET_NAME @_moc_target_name@)
|
||||||
set(AM_RELAXED_MODE "@_moc_relaxed_mode@")
|
set(AM_RELAXED_MODE "@_moc_relaxed_mode@")
|
||||||
|
@ -251,7 +251,7 @@ public:
|
|||||||
std::string EscapeForShellOldStyle(const char* str);
|
std::string EscapeForShellOldStyle(const char* str);
|
||||||
|
|
||||||
/** Escape the given string as an argument in a CMake script. */
|
/** Escape the given string as an argument in a CMake script. */
|
||||||
std::string EscapeForCMake(const char* str);
|
static std::string EscapeForCMake(const char* str);
|
||||||
|
|
||||||
enum FortranFormat
|
enum FortranFormat
|
||||||
{
|
{
|
||||||
|
@ -202,13 +202,20 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
|
|||||||
cmMakefile::ScopePushPop varScope(makefile);
|
cmMakefile::ScopePushPop varScope(makefile);
|
||||||
static_cast<void>(varScope);
|
static_cast<void>(varScope);
|
||||||
|
|
||||||
makefile->AddDefinition("_moc_target_name", automocTargetName.c_str());
|
makefile->AddDefinition("_moc_target_name",
|
||||||
makefile->AddDefinition("_moc_incs", _moc_incs.c_str());
|
cmLocalGenerator::EscapeForCMake(automocTargetName.c_str()).c_str());
|
||||||
makefile->AddDefinition("_moc_defs", _moc_defs.c_str());
|
makefile->AddDefinition("_moc_incs",
|
||||||
makefile->AddDefinition("_moc_compile_defs", _moc_compile_defs.c_str());
|
cmLocalGenerator::EscapeForCMake(_moc_incs.c_str()).c_str());
|
||||||
makefile->AddDefinition("_moc_options", _moc_options.c_str());
|
makefile->AddDefinition("_moc_defs",
|
||||||
makefile->AddDefinition("_moc_files", _moc_files.c_str());
|
cmLocalGenerator::EscapeForCMake(_moc_defs.c_str()).c_str());
|
||||||
makefile->AddDefinition("_moc_headers", _moc_headers.c_str());
|
makefile->AddDefinition("_moc_compile_defs",
|
||||||
|
cmLocalGenerator::EscapeForCMake(_moc_compile_defs.c_str()).c_str());
|
||||||
|
makefile->AddDefinition("_moc_options",
|
||||||
|
cmLocalGenerator::EscapeForCMake(_moc_options.c_str()).c_str());
|
||||||
|
makefile->AddDefinition("_moc_files",
|
||||||
|
cmLocalGenerator::EscapeForCMake(_moc_files.c_str()).c_str());
|
||||||
|
makefile->AddDefinition("_moc_headers",
|
||||||
|
cmLocalGenerator::EscapeForCMake(_moc_headers.c_str()).c_str());
|
||||||
makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE");
|
makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE");
|
||||||
|
|
||||||
const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT");
|
const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT");
|
||||||
@ -340,8 +347,9 @@ void cmQtAutomoc::WriteOldMocDefinitionsFile(const char* targetDirectory)
|
|||||||
std::fstream outfile;
|
std::fstream outfile;
|
||||||
outfile.open(filename.c_str(),
|
outfile.open(filename.c_str(),
|
||||||
std::ios::out | std::ios::trunc);
|
std::ios::out | std::ios::trunc);
|
||||||
outfile << "set(AM_OLD_MOC_DEFINITIONS \""
|
outfile << "set(AM_OLD_MOC_DEFINITIONS "
|
||||||
<< this->Join(this->MocDefinitions, ' ') << "\")\n";
|
<< cmLocalGenerator::EscapeForCMake(
|
||||||
|
this->Join(this->MocDefinitions, ' ').c_str()) << ")\n";
|
||||||
|
|
||||||
outfile.close();
|
outfile.close();
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ include(UseQt4)
|
|||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
add_definitions(-DFOO)
|
add_definitions(-DFOO -DSomeDefine="Barx")
|
||||||
|
|
||||||
# enable relaxed mode so automoc can handle all the special cases:
|
# enable relaxed mode so automoc can handle all the special cases:
|
||||||
set(CMAKE_AUTOMOC_RELAXED_MODE TRUE)
|
set(CMAKE_AUTOMOC_RELAXED_MODE TRUE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user