diff options
author | David Cole <david.cole@kitware.com> | 2011-11-08 19:42:46 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2011-11-08 19:42:46 (GMT) |
commit | 6c2f30822bc4eec4bd3e47d0f06fbf9627a21d45 (patch) | |
tree | 47f4b6244e002266cbcf5fffe66be1eccee28b97 /Source/cmQtAutomoc.cxx | |
parent | d8d4e801acf486bd63d73c00733faeba8b2eea71 (diff) | |
parent | 1ecc55aa7b95a487996654e81d6493e7b72961c0 (diff) | |
download | CMake-6c2f30822bc4eec4bd3e47d0f06fbf9627a21d45.zip CMake-6c2f30822bc4eec4bd3e47d0f06fbf9627a21d45.tar.gz CMake-6c2f30822bc4eec4bd3e47d0f06fbf9627a21d45.tar.bz2 |
Merge topic 'DontCrashAutomocWithEmptyCompileDefs'
1ecc55a Automoc: fix the fix, need to use std::string, not just char* pointer
8c8305f don't crash in automoc with empty COMPILE_DEFINITIONS property
Diffstat (limited to 'Source/cmQtAutomoc.cxx')
-rw-r--r-- | Source/cmQtAutomoc.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index fea2e79..0f74437 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -124,9 +124,13 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) } } - std::string _moc_incs = makefile->GetProperty("INCLUDE_DIRECTORIES"); - std::string _moc_defs = makefile->GetProperty("DEFINITIONS"); - std::string _moc_compile_defs = makefile->GetProperty("COMPILE_DEFINITIONS"); + const char* tmp = makefile->GetProperty("INCLUDE_DIRECTORIES"); + std::string _moc_incs = (tmp!=0 ? tmp : ""); + tmp = makefile->GetProperty("DEFINITIONS"); + std::string _moc_defs = (tmp!=0 ? tmp : ""); + tmp = makefile->GetProperty("COMPILE_DEFINITIONS"); + std::string _moc_compile_defs = (tmp!=0 ? tmp : ""); + // forget the variables added here afterwards again: cmMakefile::ScopePushPop varScope(makefile); static_cast<void>(varScope); @@ -138,7 +142,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) makefile->AddDefinition("_moc_files", _moc_files.c_str()); makefile->AddDefinition("_moc_headers", _moc_headers.c_str()); - const char* cmakeRoot = makefile->GetDefinition("CMAKE_ROOT"); + const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT"); std::string inputFile = cmakeRoot; inputFile += "/Modules/AutomocInfo.cmake.in"; std::string outputFile = targetDir; |