summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/add_executable.rst3
-rw-r--r--Help/command/add_library.rst4
-rw-r--r--Help/prop_sf/HEADER_FILE_ONLY.rst15
-rw-r--r--Modules/FindOpenMP.cmake37
-rw-r--r--Modules/Internal/FeatureTesting.cmake10
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cmCPackGenerator.cxx2
-rw-r--r--Source/CPack/cpack.cxx4
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx2
-rw-r--r--Source/CTest/cmCTestLaunch.cxx2
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx6
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx2
-rw-r--r--Source/CursesDialog/ccmake.cxx2
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx2
-rw-r--r--Source/QtDialog/CMakeSetup.cxx2
-rw-r--r--Source/QtDialog/QCMake.cxx2
-rw-r--r--Source/cmBreakCommand.h5
-rw-r--r--Source/cmBuildNameCommand.h1
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.h5
-rw-r--r--Source/cmCMakeMinimumRequired.h5
-rw-r--r--Source/cmCMakePolicyCommand.h5
-rw-r--r--Source/cmCTest.cxx2
-rw-r--r--Source/cmCommand.h5
-rw-r--r--Source/cmCommands.cxx61
-rw-r--r--Source/cmCommands.h1
-rw-r--r--Source/cmConfigureFileCommand.h5
-rw-r--r--Source/cmContinueCommand.h5
-rw-r--r--Source/cmDisallowedCommand.h5
-rw-r--r--Source/cmExecProgramCommand.h5
-rw-r--r--Source/cmExecuteProcessCommand.h5
-rw-r--r--Source/cmFileCommand.h5
-rw-r--r--Source/cmFindLibraryCommand.h5
-rw-r--r--Source/cmFindPackageCommand.h5
-rw-r--r--Source/cmFindPathCommand.h5
-rw-r--r--Source/cmFindProgramCommand.h5
-rw-r--r--Source/cmForEachCommand.h5
-rw-r--r--Source/cmFunctionCommand.cxx5
-rw-r--r--Source/cmFunctionCommand.h5
-rw-r--r--Source/cmGetCMakePropertyCommand.h5
-rw-r--r--Source/cmGetDirectoryPropertyCommand.h5
-rw-r--r--Source/cmGetFilenameComponentCommand.h5
-rw-r--r--Source/cmGetPropertyCommand.h5
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx4
-rw-r--r--Source/cmGraphVizWriter.cxx2
-rw-r--r--Source/cmIfCommand.h5
-rw-r--r--Source/cmIncludeCommand.h5
-rw-r--r--Source/cmListCommand.h5
-rw-r--r--Source/cmLocalNinjaGenerator.cxx8
-rw-r--r--Source/cmMacroCommand.cxx5
-rw-r--r--Source/cmMacroCommand.h5
-rw-r--r--Source/cmMakeDirectoryCommand.h5
-rw-r--r--Source/cmMakefile.cxx17
-rw-r--r--Source/cmMarkAsAdvancedCommand.h8
-rw-r--r--Source/cmMathCommand.h5
-rw-r--r--Source/cmMessageCommand.h5
-rw-r--r--Source/cmOptionCommand.h5
-rw-r--r--Source/cmParseArgumentsCommand.h5
-rw-r--r--Source/cmQtAutoGenerators.cxx2
-rw-r--r--Source/cmRemoveCommand.h5
-rw-r--r--Source/cmReturnCommand.h5
-rw-r--r--Source/cmSeparateArgumentsCommand.h5
-rw-r--r--Source/cmServerProtocol.cxx2
-rw-r--r--Source/cmSetCommand.h5
-rw-r--r--Source/cmSetDirectoryPropertiesCommand.h5
-rw-r--r--Source/cmSetPropertyCommand.h5
-rw-r--r--Source/cmSiteNameCommand.h5
-rw-r--r--Source/cmState.cxx15
-rw-r--r--Source/cmState.h1
-rw-r--r--Source/cmStringCommand.h5
-rw-r--r--Source/cmUnexpectedCommand.h2
-rw-r--r--Source/cmUnsetCommand.h5
-rw-r--r--Source/cmUseMangledMesaCommand.h1
-rw-r--r--Source/cmVariableWatchCommand.h5
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx4
-rw-r--r--Source/cmWhileCommand.h5
-rw-r--r--Source/cmWriteFileCommand.h5
-rw-r--r--Source/cmake.cxx17
-rw-r--r--Source/cmake.h9
-rw-r--r--Source/cmakemain.cxx8
-rw-r--r--Source/cmcmd.cxx4
-rw-r--r--Source/ctest.cxx6
-rw-r--r--Tests/FindMPI/Test/CMakeLists.txt2
-rw-r--r--Tests/FindOpenMP/Test/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/Ninja/CommandConcat.cmake14
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake10
86 files changed, 196 insertions, 326 deletions
diff --git a/Help/command/add_executable.rst b/Help/command/add_executable.rst
index 19ca658..c088796 100644
--- a/Help/command/add_executable.rst
+++ b/Help/command/add_executable.rst
@@ -40,6 +40,9 @@ the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
+See also :prop_sf:`HEADER_FILE_ONLY` on what to do if some sources are
+pre-processed, and you want to have the original sources reachable from
+within IDE.
--------------------------------------------------------------------------
diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst
index 3a76040..02788e3 100644
--- a/Help/command/add_library.rst
+++ b/Help/command/add_library.rst
@@ -59,6 +59,10 @@ the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
+See also :prop_sf:`HEADER_FILE_ONLY` on what to do if some sources are
+pre-processed, and you want to have the original sources reachable from
+within IDE.
+
Imported Libraries
^^^^^^^^^^^^^^^^^^
diff --git a/Help/prop_sf/HEADER_FILE_ONLY.rst b/Help/prop_sf/HEADER_FILE_ONLY.rst
index b4fb2db..71d62ae 100644
--- a/Help/prop_sf/HEADER_FILE_ONLY.rst
+++ b/Help/prop_sf/HEADER_FILE_ONLY.rst
@@ -7,3 +7,18 @@ A property on a source file that indicates if the source file is a
header file with no associated implementation. This is set
automatically based on the file extension and is used by CMake to
determine if certain dependency information should be computed.
+
+By setting this property to ``ON``, you can disable compilation of
+the given source file, even if it should be compiled because it is
+part of the library's/executable's sources.
+
+This is useful if you have some source files which you somehow
+pre-process, and then add these pre-processed sources via
+:command:`add_library` or :command:`add_executable`. Normally, in IDE,
+there would be no reference of the original sources, only of these
+pre-processed sources. So by setting this property for all the original
+source files to ``ON``, and then either calling :command:`add_library`
+or :command:`add_executable` while passing both the pre-processed
+sources and the original sources, or by using :command:`target_sources`
+to add original source files will do exactly what would one expect, i.e.
+the original source files would be visible in IDE, and will not be built.
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index e7d9d5f..1093be0 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -76,10 +76,10 @@ cmake_policy(SET CMP0057 NEW) # if IN_LIST
function(_OPENMP_FLAG_CANDIDATES LANG)
if(NOT OpenMP_${LANG}_FLAG)
- set(OpenMP_FLAG_CANDIDATES "")
+ unset(OpenMP_FLAG_CANDIDATES)
set(OMP_FLAG_GNU "-fopenmp")
- set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5")
+ set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5" "-fopenmp")
set(OMP_FLAG_HP "+Oopenmp")
if(WIN32)
set(OMP_FLAG_Intel "-Qopenmp")
@@ -92,16 +92,21 @@ function(_OPENMP_FLAG_CANDIDATES LANG)
set(OMP_FLAG_MIPSpro "-mp")
set(OMP_FLAG_MSVC "-openmp")
set(OMP_FLAG_PathScale "-openmp")
+ set(OMP_FLAG_NAG "-openmp")
+ set(OMP_FLAG_Absoft "-openmp")
set(OMP_FLAG_PGI "-mp")
set(OMP_FLAG_SunPro "-xopenmp")
set(OMP_FLAG_XL "-qsmp=omp")
# Cray compiles with OpenMP automatically
+ set(OMP_FLAG_Cray " ")
+ # If we know the correct flags, use those
if(DEFINED OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID})
- list(APPEND OpenMP_FLAG_CANDIDATES "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}")
+ set(OpenMP_FLAG_CANDIDATES "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}")
+ # Fall back to reasonable default tries otherwise
+ else()
+ set(OpenMP_FLAG_CANDIDATES "-openmp" "-fopenmp" "-mp" " ")
endif()
-
- list(APPEND OpenMP_FLAG_CANDIDATES " ")
set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_FLAG_CANDIDATES}" PARENT_SCOPE)
else()
set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_${LANG}_FLAG}" PARENT_SCOPE)
@@ -152,7 +157,7 @@ endfunction()
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
-function(_OPENMP_GET_FLAGS LANG OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
+function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
_OPENMP_FLAG_CANDIDATES("${LANG}")
_OPENMP_WRITE_SOURCE_FILE("${LANG}" "TEST_SOURCE" OpenMPTryFlag _OPENMP_TEST_SRC)
@@ -161,13 +166,13 @@ function(_OPENMP_GET_FLAGS LANG OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
if(CMAKE_${LANG}_VERBOSE_FLAG)
string(APPEND OPENMP_FLAGS_TEST " ${CMAKE_${LANG}_VERBOSE_FLAG}")
endif()
- try_compile( OpenMP_TRY_COMPILE_RESULT ${CMAKE_BINARY_DIR} ${_OPENMP_TEST_SRC}
+ string(REGEX REPLACE "[-/=+]" "" OPENMP_PLAIN_FLAG "${OPENMP_FLAG}")
+ try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG} ${CMAKE_BINARY_DIR} ${_OPENMP_TEST_SRC}
CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OPENMP_FLAGS_TEST}"
OUTPUT_VARIABLE OpenMP_TRY_COMPILE_OUTPUT
)
- if(OpenMP_TRY_COMPILE_RESULT)
- unset(OpenMP_TRY_COMPILE_RESULT CACHE)
+ if(OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG})
set("${OPENMP_FLAG_VAR}" "${OPENMP_FLAG}" PARENT_SCOPE)
if(CMAKE_${LANG}_VERBOSE_FLAG)
@@ -219,7 +224,6 @@ function(_OPENMP_GET_FLAGS LANG OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
endif()
set("${OPENMP_LIB_NAMES_VAR}" "NOTFOUND" PARENT_SCOPE)
set("${OPENMP_FLAG_VAR}" "NOTFOUND" PARENT_SCOPE)
- unset(OpenMP_TRY_COMPILE_RESULT CACHE)
endforeach()
endfunction()
@@ -265,19 +269,18 @@ function(_OPENMP_GET_SPEC_DATE LANG SPEC_DATE)
_OPENMP_WRITE_SOURCE_FILE("${LANG}" "CHECK_VERSION_SOURCE" OpenMPCheckVersion _OPENMP_TEST_SRC)
set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindOpenMP/ompver_${LANG}.bin")
- try_compile(OpenMP_TRY_COMPILE_RESULT "${CMAKE_BINARY_DIR}" "${_OPENMP_TEST_SRC}"
+ string(REGEX REPLACE "[-/=+]" "" OPENMP_PLAIN_FLAG "${OPENMP_FLAG}")
+ try_compile(OpenMP_SPECTEST_${LANG}_${OPENMP_PLAIN_FLAG} "${CMAKE_BINARY_DIR}" "${_OPENMP_TEST_SRC}"
CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OpenMP_${LANG}_FLAGS}"
COPY_FILE ${BIN_FILE})
- if(${OpenMP_TRY_COMPILE_RESULT})
+ if(${OpenMP_SPECTEST_${LANG}_${OPENMP_PLAIN_FLAG}})
file(STRINGS ${BIN_FILE} specstr LIMIT_COUNT 1 REGEX "INFO:OpenMP-date")
set(regex_spec_date ".*INFO:OpenMP-date\\[0*([^]]*)\\].*")
if("${specstr}" MATCHES "${regex_spec_date}")
set(${SPEC_DATE} "${CMAKE_MATCH_1}" PARENT_SCOPE)
endif()
endif()
-
- unset(OpenMP_TRY_COMPILE_RESULT CACHE)
endfunction()
macro(_OPENMP_SET_VERSION_BY_SPEC_DATE LANG)
@@ -318,7 +321,7 @@ foreach(LANG IN ITEMS C CXX)
if(CMAKE_${LANG}_COMPILER_LOADED)
if(NOT DEFINED OpenMP_${LANG}_FLAGS OR "${OpenMP_${LANG}_FLAGS}" STREQUAL "NOTFOUND"
OR NOT DEFINED OpenMP_${LANG}_LIB_NAMES OR "${OpenMP_${LANG}_LIB_NAMES}" STREQUAL "NOTFOUND")
- _OPENMP_GET_FLAGS("${LANG}" OpenMP_${LANG}_FLAGS_WORK OpenMP_${LANG}_LIB_NAMES_WORK)
+ _OPENMP_GET_FLAGS("${LANG}" "${LANG}" OpenMP_${LANG}_FLAGS_WORK OpenMP_${LANG}_LIB_NAMES_WORK)
endif()
set(OpenMP_${LANG}_FLAGS "${OpenMP_${LANG}_FLAGS_WORK}"
@@ -334,7 +337,7 @@ if(CMAKE_Fortran_COMPILER_LOADED)
OR NOT DEFINED OpenMP_Fortran_LIB_NAMES OR "${OpenMP_Fortran_LIB_NAMES}" STREQUAL "NOTFOUND"
OR NOT DEFINED OpenMP_Fortran_HAVE_OMPLIB_MODULE)
set(OpenMP_Fortran_INCLUDE_LINE "use omp_lib\n implicit none")
- _OPENMP_GET_FLAGS("Fortran" OpenMP_Fortran_FLAGS_WORK OpenMP_Fortran_LIB_NAMES_WORK)
+ _OPENMP_GET_FLAGS("Fortran" "FortranHeader" OpenMP_Fortran_FLAGS_WORK OpenMP_Fortran_LIB_NAMES_WORK)
if(OpenMP_Fortran_FLAGS_WORK)
set(OpenMP_Fortran_HAVE_OMPLIB_MODULE TRUE CACHE BOOL INTERNAL "")
endif()
@@ -350,7 +353,7 @@ if(CMAKE_Fortran_COMPILER_LOADED)
OR NOT DEFINED OpenMP_Fortran_LIB_NAMES OR "${OpenMP_Fortran_LIB_NAMES}" STREQUAL "NOTFOUND"
OR NOT DEFINED OpenMP_Fortran_HAVE_OMPLIB_HEADER)
set(OpenMP_Fortran_INCLUDE_LINE "implicit none\n include 'omp_lib.h'")
- _OPENMP_GET_FLAGS("Fortran" OpenMP_Fortran_FLAGS_WORK OpenMP_Fortran_LIB_NAMES_WORK)
+ _OPENMP_GET_FLAGS("Fortran" "FortranModule" OpenMP_Fortran_FLAGS_WORK OpenMP_Fortran_LIB_NAMES_WORK)
if(OpenMP_Fortran_FLAGS_WORK)
set(OpenMP_Fortran_HAVE_OMPLIB_HEADER TRUE CACHE BOOL INTERNAL "")
endif()
diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake
index 50b8526..de336e7 100644
--- a/Modules/Internal/FeatureTesting.cmake
+++ b/Modules/Internal/FeatureTesting.cmake
@@ -22,9 +22,18 @@ macro(_record_compiler_features lang compile_flags feature_list)
file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}"
"\n};\n\nint main(int argc, char** argv) { (void)argv; return features[argc]; }\n")
+ if(CMAKE_${lang}_LINK_WITH_STANDARD_COMPILE_OPTION)
+ # This toolchain requires use of the language standard flag
+ # when linking in order to use the matching standard library.
+ set(compile_flags_for_link "${compile_flags}")
+ else()
+ set(compile_flags_for_link "")
+ endif()
+
try_compile(CMAKE_${lang}_FEATURE_TEST
${CMAKE_BINARY_DIR} "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}"
COMPILE_DEFINITIONS "${compile_flags}"
+ LINK_LIBRARIES "${compile_flags_for_link}"
OUTPUT_VARIABLE _output
COPY_FILE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin"
COPY_FILE_ERROR _copy_error
@@ -35,6 +44,7 @@ macro(_record_compiler_features lang compile_flags feature_list)
set(_result 255)
endif()
unset(CMAKE_${lang}_FEATURE_TEST CACHE)
+ unset(compile_flags_for_link)
if (_result EQUAL 0)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index e702359..6c443d6 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 8)
-set(CMake_VERSION_PATCH 20170509)
+set(CMake_VERSION_PATCH 20170511)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index c5495c6..c873529 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -620,7 +620,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
<< installComponent << std::endl);
}
- cmake cm;
+ cmake cm(cmake::RoleScript);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index a48c8cd..a44bc3d 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -23,7 +23,6 @@
#include "cmDocumentationEntry.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
-#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cm_auto_ptr.hxx"
@@ -189,11 +188,10 @@ int main(int argc, char const* const* argv)
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
"Read CPack config file: " << cpackConfigFile << std::endl);
- cmake cminst;
+ cmake cminst(cmake::RoleScript);
cminst.SetHomeDirectory("");
cminst.SetHomeOutputDirectory("");
cminst.GetCurrentSnapshot().SetDefaultDefinitions();
- cminst.GetState()->RemoveUnscriptableCommands();
cmGlobalGenerator cmgg(&cminst);
CM_AUTO_PTR<cmMakefile> globalMF(
new cmMakefile(&cmgg, cminst.GetCurrentSnapshot()));
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index ed7dd5d..cc29071 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -167,7 +167,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
return 1;
}
- cmake cm;
+ cmake cm(cmake::RoleProject);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
std::string cmakeOutString;
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index a782150..5b21351 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -623,7 +623,7 @@ int cmCTestLaunch::Main(int argc, const char* const argv[])
void cmCTestLaunch::LoadConfig()
{
- cmake cm;
+ cmake cm(cmake::RoleScript);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 60e48b6..1fea8e5 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -275,7 +275,7 @@ void cmCTestScriptHandler::CreateCMake()
delete this->GlobalGenerator;
delete this->Makefile;
}
- this->CMake = new cmake;
+ this->CMake = new cmake(cmake::RoleScript);
this->CMake->SetHomeDirectory("");
this->CMake->SetHomeOutputDirectory("");
this->CMake->GetCurrentSnapshot().SetDefaultDefinitions();
@@ -290,10 +290,6 @@ void cmCTestScriptHandler::CreateCMake()
this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest);
- // remove all cmake commands which are not scriptable, since they can't be
- // used in ctest scripts
- this->CMake->GetState()->RemoveUnscriptableCommands();
-
// add any ctest specific commands, probably should have common superclass
// for ctest commands to clean this up. If a couple more commands are
// created with the same format lets do that - ken
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index a5cc1fa..349e91a 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1650,7 +1650,7 @@ void cmCTestTestHandler::GetListOfTests()
}
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Constructing a list of tests" << std::endl, this->Quiet);
- cmake cm;
+ cmake cm(cmake::RoleScript);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 1698a84..28a0e95 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -81,7 +81,7 @@ int main(int argc, char const* const* argv)
cmDocumentation doc;
doc.addCMakeStandardDocSections();
if (doc.CheckOptions(argc, argv)) {
- cmake hcm;
+ cmake hcm(cmake::RoleInternal);
hcm.SetHomeDirectory("");
hcm.SetHomeOutputDirectory("");
hcm.AddCMakePaths();
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index ca824c0..0fa7aa5 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -40,7 +40,7 @@ cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args,
"Welcome to ccmake, curses based user interface for CMake.");
this->HelpMessage.push_back("");
this->HelpMessage.push_back(s_ConstHelpMessage);
- this->CMakeInstance = new cmake;
+ this->CMakeInstance = new cmake(cmake::RoleProject);
this->CMakeInstance->SetCMakeEditCommand(
cmSystemTools::GetCMakeCursesCommand());
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index b955d77..7fa2ac6 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -59,7 +59,7 @@ int main(int argc, char** argv)
doc.addCMakeStandardDocSections();
if (argc2 > 1 && doc.CheckOptions(argc2, argv2)) {
// Construct and print requested documentation.
- cmake hcm;
+ cmake hcm(cmake::RoleInternal);
hcm.SetHomeDirectory("");
hcm.SetHomeOutputDirectory("");
hcm.AddCMakePaths();
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 28820a6..d473d9b 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -27,7 +27,7 @@ QCMake::QCMake(QObject* p)
cmSystemTools::SetStdoutCallback(QCMake::stdoutCallback, this);
cmSystemTools::SetStderrCallback(QCMake::stderrCallback, this);
- this->CMakeInstance = new cmake;
+ this->CMakeInstance = new cmake(cmake::RoleProject);
this->CMakeInstance->SetCMakeEditCommand(
cmSystemTools::GetCMakeGUICommand());
this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this);
diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h
index 8ce5ca2..0038883 100644
--- a/Source/cmBreakCommand.h
+++ b/Source/cmBreakCommand.h
@@ -33,11 +33,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "break"; }
diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h
index 00f645a..9008c27 100644
--- a/Source/cmBuildNameCommand.h
+++ b/Source/cmBuildNameCommand.h
@@ -19,7 +19,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
std::string GetName() const CM_OVERRIDE { return "build_name"; }
- bool IsScriptable() const CM_OVERRIDE { return true; }
};
#endif
diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h
index fe148a3..4263e75 100644
--- a/Source/cmCMakeHostSystemInformationCommand.h
+++ b/Source/cmCMakeHostSystemInformationCommand.h
@@ -41,11 +41,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE
diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h
index 8db0860..d264675 100644
--- a/Source/cmCMakeMinimumRequired.h
+++ b/Source/cmCMakeMinimumRequired.h
@@ -33,11 +33,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "cmake_minimum_required"; }
diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h
index 789e294..cc02169 100644
--- a/Source/cmCMakePolicyCommand.h
+++ b/Source/cmCMakePolicyCommand.h
@@ -34,11 +34,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "cmake_policy"; }
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 010221e..f469998 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -416,7 +416,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
}
}
- cmake cm;
+ cmake cm(cmake::RoleScript);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index 62eced0..2e2ba43 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -80,11 +80,6 @@ public:
virtual cmCommand* Clone() = 0;
/**
- * This determines if the command is invoked when in script mode.
- */
- virtual bool IsScriptable() const { return false; }
-
- /**
* This determines if the command is defined in a cmake script.
* It is the case for cmMacroHelperCommand and cmFunctionHelperCommand.
*/
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 1576722..adf46ff 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -266,3 +266,64 @@ void GetProjectCommands(cmState* state)
"The variable_requires command should not be called; see CMP0035."));
#endif
}
+
+void GetProjectCommandsInScriptMode(cmState* state)
+{
+#define CM_UNEXPECTED_PROJECT_COMMAND(NAME) \
+ state->AddCommand(new cmUnexpectedCommand(NAME, "command is not " \
+ "scriptable"))
+
+ CM_UNEXPECTED_PROJECT_COMMAND("add_compile_options");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_custom_command");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_custom_target");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_definitions");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_dependencies");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_executable");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_library");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_subdirectory");
+ CM_UNEXPECTED_PROJECT_COMMAND("add_test");
+ CM_UNEXPECTED_PROJECT_COMMAND("aux_source_directory");
+ CM_UNEXPECTED_PROJECT_COMMAND("build_command");
+ CM_UNEXPECTED_PROJECT_COMMAND("create_test_sourcelist");
+ CM_UNEXPECTED_PROJECT_COMMAND("define_property");
+ CM_UNEXPECTED_PROJECT_COMMAND("enable_language");
+ CM_UNEXPECTED_PROJECT_COMMAND("enable_testing");
+ CM_UNEXPECTED_PROJECT_COMMAND("export");
+ CM_UNEXPECTED_PROJECT_COMMAND("fltk_wrap_ui");
+ CM_UNEXPECTED_PROJECT_COMMAND("get_source_file_property");
+ CM_UNEXPECTED_PROJECT_COMMAND("get_target_property");
+ CM_UNEXPECTED_PROJECT_COMMAND("get_test_property");
+ CM_UNEXPECTED_PROJECT_COMMAND("include_directories");
+ CM_UNEXPECTED_PROJECT_COMMAND("include_external_msproject");
+ CM_UNEXPECTED_PROJECT_COMMAND("include_regular_expression");
+ CM_UNEXPECTED_PROJECT_COMMAND("install");
+ CM_UNEXPECTED_PROJECT_COMMAND("link_directories");
+ CM_UNEXPECTED_PROJECT_COMMAND("link_libraries");
+ CM_UNEXPECTED_PROJECT_COMMAND("load_cache");
+ CM_UNEXPECTED_PROJECT_COMMAND("project");
+ CM_UNEXPECTED_PROJECT_COMMAND("qt_wrap_cpp");
+ CM_UNEXPECTED_PROJECT_COMMAND("qt_wrap_ui");
+ CM_UNEXPECTED_PROJECT_COMMAND("remove_definitions");
+ CM_UNEXPECTED_PROJECT_COMMAND("set_source_files_properties");
+ CM_UNEXPECTED_PROJECT_COMMAND("set_target_properties");
+ CM_UNEXPECTED_PROJECT_COMMAND("set_tests_properties");
+ CM_UNEXPECTED_PROJECT_COMMAND("source_group");
+ CM_UNEXPECTED_PROJECT_COMMAND("target_compile_definitions");
+ CM_UNEXPECTED_PROJECT_COMMAND("target_compile_features");
+ CM_UNEXPECTED_PROJECT_COMMAND("target_compile_options");
+ CM_UNEXPECTED_PROJECT_COMMAND("target_include_directories");
+ CM_UNEXPECTED_PROJECT_COMMAND("target_link_libraries");
+ CM_UNEXPECTED_PROJECT_COMMAND("target_sources");
+ CM_UNEXPECTED_PROJECT_COMMAND("try_compile");
+ CM_UNEXPECTED_PROJECT_COMMAND("try_run");
+
+ // deprected commands
+ CM_UNEXPECTED_PROJECT_COMMAND("export_library_dependencies");
+ CM_UNEXPECTED_PROJECT_COMMAND("load_command");
+ CM_UNEXPECTED_PROJECT_COMMAND("output_required_files");
+ CM_UNEXPECTED_PROJECT_COMMAND("subdir_depends");
+ CM_UNEXPECTED_PROJECT_COMMAND("utility_source");
+ CM_UNEXPECTED_PROJECT_COMMAND("variable_requires");
+
+#undef CM_UNEXPECTED_PROJECT_COMMAND
+}
diff --git a/Source/cmCommands.h b/Source/cmCommands.h
index 7895ece..1f8fafb 100644
--- a/Source/cmCommands.h
+++ b/Source/cmCommands.h
@@ -12,5 +12,6 @@ class cmState;
*/
void GetScriptingCommands(cmState* state);
void GetProjectCommands(cmState* state);
+void GetProjectCommandsInScriptMode(cmState* state);
#endif
diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h
index 882219d..402423d 100644
--- a/Source/cmConfigureFileCommand.h
+++ b/Source/cmConfigureFileCommand.h
@@ -30,11 +30,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "configure_file"; }
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
private:
int ConfigureFile();
diff --git a/Source/cmContinueCommand.h b/Source/cmContinueCommand.h
index 4428d79..4b416a4 100644
--- a/Source/cmContinueCommand.h
+++ b/Source/cmContinueCommand.h
@@ -33,11 +33,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "continue"; }
diff --git a/Source/cmDisallowedCommand.h b/Source/cmDisallowedCommand.h
index 7c141dd..38d1d93 100644
--- a/Source/cmDisallowedCommand.h
+++ b/Source/cmDisallowedCommand.h
@@ -42,11 +42,6 @@ public:
return this->Command->HasFinalPass();
}
- bool IsScriptable() const CM_OVERRIDE
- {
- return this->Command->IsScriptable();
- }
-
std::string GetName() const CM_OVERRIDE { return this->Command->GetName(); }
private:
diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h
index 53d35cf..2a59612 100644
--- a/Source/cmExecProgramCommand.h
+++ b/Source/cmExecProgramCommand.h
@@ -41,11 +41,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "exec_program"; }
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
private:
static bool RunCommand(const char* command, std::string& output, int& retVal,
const char* directory = CM_NULLPTR,
diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h
index 65e16d4..e57e22d 100644
--- a/Source/cmExecuteProcessCommand.h
+++ b/Source/cmExecuteProcessCommand.h
@@ -37,11 +37,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "execute_process"; }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
};
#endif
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index 121fec0..ff0b35e 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -32,11 +32,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "file"; }
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index 4a60505..41af976 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -37,11 +37,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "find_library"; }
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index c42ecce..e4ecfad 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -61,11 +61,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "find_package"; }
diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h
index 205bb17..92849c3 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -37,11 +37,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "find_path"; }
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index 73894ba..af56aef 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -38,11 +38,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "find_program"; }
diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h
index c71b905..30f0342 100644
--- a/Source/cmForEachCommand.h
+++ b/Source/cmForEachCommand.h
@@ -49,11 +49,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "foreach"; }
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index e5fe988..dccc29f 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -40,11 +40,6 @@ public:
}
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h
index d6cc18e..fa13aa4 100644
--- a/Source/cmFunctionCommand.h
+++ b/Source/cmFunctionCommand.h
@@ -46,11 +46,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "function"; }
diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h
index c454e34..b0ddb22 100644
--- a/Source/cmGetCMakePropertyCommand.h
+++ b/Source/cmGetCMakePropertyCommand.h
@@ -25,11 +25,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "get_cmake_property"; }
diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h
index 0adf818..f91a466 100644
--- a/Source/cmGetDirectoryPropertyCommand.h
+++ b/Source/cmGetDirectoryPropertyCommand.h
@@ -25,11 +25,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "get_directory_property"; }
diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h
index efc9d7b..cf64564 100644
--- a/Source/cmGetFilenameComponentCommand.h
+++ b/Source/cmGetFilenameComponentCommand.h
@@ -34,11 +34,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "get_filename_component"; }
diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h
index a57c675..7bbcec0 100644
--- a/Source/cmGetPropertyCommand.h
+++ b/Source/cmGetPropertyCommand.h
@@ -27,11 +27,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "get_property"; }
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 587e18a..d9a8cab 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1903,7 +1903,7 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,
}
}
- cmake cm;
+ cmake cm(cmake::RoleInternal);
cm.SetHomeDirectory(dir_top_src);
cm.SetHomeOutputDirectory(dir_top_bld);
CM_AUTO_PTR<cmGlobalNinjaGenerator> ggd(
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index ee9e47a..0e02b0a 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -647,9 +647,9 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
xw.EndElement(); // ItemGroup
xw.StartElement("PropertyGroup");
xw.Attribute("Label", "Globals");
- xw.StartElement("ProjectGUID");
+ xw.StartElement("ProjectGuid");
xw.Content("{F3FC6D86-508D-3FB1-96D2-995F08B142EC}");
- xw.EndElement(); // ProjectGUID
+ xw.EndElement(); // ProjectGuid
xw.StartElement("Keyword");
xw.Content("Win32Proj");
xw.EndElement(); // Keyword
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 1fcd3cb..7e953ce 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -61,7 +61,7 @@ cmGraphVizWriter::cmGraphVizWriter(
void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
const char* fallbackSettingsFileName)
{
- cmake cm;
+ cmake cm(cmake::RoleScript);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index 59d32e6..c6c44cb 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -69,11 +69,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "if"; }
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
// Filter the given variable definition based on policy CMP0054.
static const char* GetDefinitionIfUnquoted(
const cmMakefile* mf, cmExpandedCommandArgument const& argument);
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index 06200cd..5a37800 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -34,11 +34,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "include"; }
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h
index 8d4aeb1..7272ea1 100644
--- a/Source/cmListCommand.h
+++ b/Source/cmListCommand.h
@@ -32,11 +32,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "list"; }
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index e0e3e54..124bd80 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -322,7 +322,13 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
} else if (cmdLines.size() > 1) {
cmd << "cmd.exe /C \"";
}
- cmd << *li;
+ // Put current cmdLine in brackets if it contains "||" because it has
+ // higher precedence than "&&" in cmd.exe
+ if (li->find("||") != std::string::npos) {
+ cmd << "( " << *li << " )";
+ } else {
+ cmd << *li;
+ }
}
if (cmdLines.size() > 1) {
cmd << "\"";
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 4830371..507b579 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -41,11 +41,6 @@ public:
}
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h
index f0020ff..fd9c92b 100644
--- a/Source/cmMacroCommand.h
+++ b/Source/cmMacroCommand.h
@@ -46,11 +46,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "macro"; }
diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h
index 54f4ab3..e2f0932 100644
--- a/Source/cmMakeDirectoryCommand.h
+++ b/Source/cmMakeDirectoryCommand.h
@@ -40,11 +40,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "make_directory"; }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
};
#endif
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 3569abe..5af0084 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -272,11 +272,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
pcmd->SetMakefile(this);
// Decide whether to invoke the command.
- if (!cmSystemTools::GetFatalErrorOccured() &&
- (this->GetCMakeInstance()->GetWorkingMode() != cmake::SCRIPT_MODE ||
- pcmd->IsScriptable()))
-
- {
+ if (!cmSystemTools::GetFatalErrorOccured()) {
// if trace is enabled, print out invoke information
if (this->GetCMakeInstance()->GetTrace()) {
this->PrintCommandTrace(lff);
@@ -298,15 +294,6 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
// use the command
this->FinalPassCommands.push_back(pcmd.release());
}
- } else if (this->GetCMakeInstance()->GetWorkingMode() ==
- cmake::SCRIPT_MODE &&
- !pcmd->IsScriptable()) {
- std::string error = "Command ";
- error += pcmd->GetName();
- error += "() is not scriptable";
- this->IssueMessage(cmake::FATAL_ERROR, error);
- result = false;
- cmSystemTools::SetFatalErrorOccured();
}
} else {
if (!cmSystemTools::GetFatalErrorOccured()) {
@@ -3187,7 +3174,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
// make sure the same generator is used
// use this program as the cmake to be run, it should not
// be run that way but the cmake object requires a vailid path
- cmake cm;
+ cmake cm(cmake::RoleProject);
cm.SetIsInTryCompile(true);
cmGlobalGenerator* gg =
cm.CreateGlobalGenerator(this->GetGlobalGenerator()->GetName());
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index 8c2f85b..4f80746 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -36,14 +36,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "mark_as_advanced"; }
-
- /**
- * This determines if the command is invoked when in script mode.
- * mark_as_advanced() will have no effect in script mode, but this will
- * make many of the modules usable in cmake/ctest scripts, (among them
- * FindUnixMake.cmake used by the CTEST_BUILD command.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
};
#endif
diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h
index 496d836..ef0eb4a 100644
--- a/Source/cmMathCommand.h
+++ b/Source/cmMathCommand.h
@@ -29,11 +29,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "math"; }
diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h
index ca83ed6..fd2dbe7 100644
--- a/Source/cmMessageCommand.h
+++ b/Source/cmMessageCommand.h
@@ -35,11 +35,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "message"; }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
};
#endif
diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h
index 86fa41f..0227357 100644
--- a/Source/cmOptionCommand.h
+++ b/Source/cmOptionCommand.h
@@ -36,11 +36,6 @@ public:
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "option"; }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
};
#endif
diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h
index 4d9416d..f3de5b6 100644
--- a/Source/cmParseArgumentsCommand.h
+++ b/Source/cmParseArgumentsCommand.h
@@ -31,11 +31,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "cmake_parse_arguments"; }
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index eec1fc6..7461a0a 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -286,7 +286,7 @@ cmQtAutoGenerators::cmQtAutoGenerators()
bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
const std::string& config)
{
- cmake cm;
+ cmake cm(cmake::RoleScript);
cm.SetHomeOutputDirectory(targetDirectory);
cm.SetHomeDirectory(targetDirectory);
cm.GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h
index 38223a5..84e591d 100644
--- a/Source/cmRemoveCommand.h
+++ b/Source/cmRemoveCommand.h
@@ -33,11 +33,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "remove"; }
diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h
index ceed6b5..a4a6283 100644
--- a/Source/cmReturnCommand.h
+++ b/Source/cmReturnCommand.h
@@ -33,11 +33,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "return"; }
diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h
index 7edde48..e4df5da 100644
--- a/Source/cmSeparateArgumentsCommand.h
+++ b/Source/cmSeparateArgumentsCommand.h
@@ -33,11 +33,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "separate_arguments"; }
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 4e9e80f..defba77 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -215,7 +215,7 @@ bool cmServerProtocol::Activate(cmServer* server,
{
assert(server);
this->m_Server = server;
- this->m_CMakeInstance = std::make_unique<cmake>();
+ this->m_CMakeInstance = std::make_unique<cmake>(cmake::RoleProject);
const bool result = this->DoActivate(request, errorMessage);
if (!result) {
this->m_CMakeInstance = CM_NULLPTR;
diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h
index 1c67bf9..e3a3175 100644
--- a/Source/cmSetCommand.h
+++ b/Source/cmSetCommand.h
@@ -33,11 +33,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "set"; }
diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h
index e04de6e..4657b66 100644
--- a/Source/cmSetDirectoryPropertiesCommand.h
+++ b/Source/cmSetDirectoryPropertiesCommand.h
@@ -29,11 +29,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index 3657f63..7f5c977 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -36,11 +36,6 @@ public:
*/
std::string GetName() const CM_OVERRIDE { return "set_property"; }
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
private:
std::set<std::string> Names;
std::string PropertyName;
diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h
index c7425f6..e133c6c 100644
--- a/Source/cmSiteNameCommand.h
+++ b/Source/cmSiteNameCommand.h
@@ -33,11 +33,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "site_name"; }
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index aca0358..43f439c 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -410,21 +410,6 @@ void cmState::AddCommand(cmCommand* command)
this->Commands.insert(std::make_pair(name, command));
}
-void cmState::RemoveUnscriptableCommands()
-{
- std::vector<std::string> unscriptableCommands;
- for (std::map<std::string, cmCommand*>::iterator pos =
- this->Commands.begin();
- pos != this->Commands.end();) {
- if (!pos->second->IsScriptable()) {
- delete pos->second;
- this->Commands.erase(pos++);
- } else {
- ++pos;
- }
- }
-}
-
cmCommand* cmState::GetCommand(std::string const& name) const
{
cmCommand* command = CM_NULLPTR;
diff --git a/Source/cmState.h b/Source/cmState.h
index d2af5ce..240d75b 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -121,7 +121,6 @@ public:
cmCommand* GetCommand(std::string const& name) const;
void AddCommand(cmCommand* command);
- void RemoveUnscriptableCommands();
void RenameCommand(std::string const& oldName, std::string const& newName);
void RemoveUserDefinedCommands();
std::vector<std::string> GetCommandNames() const;
diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h
index 89ecb12..dc3ce5a 100644
--- a/Source/cmStringCommand.h
+++ b/Source/cmStringCommand.h
@@ -32,11 +32,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "string"; }
diff --git a/Source/cmUnexpectedCommand.h b/Source/cmUnexpectedCommand.h
index aee5d4d..1605997 100644
--- a/Source/cmUnexpectedCommand.h
+++ b/Source/cmUnexpectedCommand.h
@@ -29,8 +29,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
std::string GetName() const CM_OVERRIDE { return this->Name; }
private:
diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h
index 7e0f5b5..d60bd3e 100644
--- a/Source/cmUnsetCommand.h
+++ b/Source/cmUnsetCommand.h
@@ -33,11 +33,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "unset"; }
diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h
index e8bd8c6..104614a 100644
--- a/Source/cmUseMangledMesaCommand.h
+++ b/Source/cmUseMangledMesaCommand.h
@@ -19,7 +19,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
std::string GetName() const CM_OVERRIDE { return "use_mangled_mesa"; }
- bool IsScriptable() const CM_OVERRIDE { return true; }
protected:
void CopyAndFullPathMesaHeader(const char* source, const char* outdir);
};
diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h
index 7096ed5..ca338e6 100644
--- a/Source/cmVariableWatchCommand.h
+++ b/Source/cmVariableWatchCommand.h
@@ -38,11 +38,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
/** This command does not really have a final pass but it needs to
stay alive since it owns variable watch callback information. */
bool HasFinalPass() const CM_OVERRIDE { return true; }
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index c81ba7a..4fcf5dc 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -297,8 +297,8 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteProjectConfigurations();
}
this->WriteString("<PropertyGroup Label=\"Globals\">\n", 1);
- this->WriteString("<ProjectGUID>", 2);
- (*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGUID>\n";
+ this->WriteString("<ProjectGuid>", 2);
+ (*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGuid>\n";
if (this->MSTools &&
this->GeneratorTarget->GetType() <= cmStateEnums::GLOBAL_TARGET) {
diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h
index daf1046..d353063 100644
--- a/Source/cmWhileCommand.h
+++ b/Source/cmWhileCommand.h
@@ -59,11 +59,6 @@ public:
}
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "while"; }
diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h
index 7196ccf..aea8653 100644
--- a/Source/cmWriteFileCommand.h
+++ b/Source/cmWriteFileCommand.h
@@ -32,11 +32,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
* The name of the command as specified in CMakeList.txt.
*/
std::string GetName() const CM_OVERRIDE { return "write_file"; }
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 737587d..53e9ab0 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -136,7 +136,7 @@ void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/,
cm->MarkCliAsUsed(variable);
}
-cmake::cmake()
+cmake::cmake(Role role)
{
this->Trace = false;
this->TraceExpand = false;
@@ -174,8 +174,12 @@ cmake::cmake()
this->AddDefaultGenerators();
this->AddDefaultExtraGenerators();
- this->AddScriptingCommands();
- this->AddProjectCommands();
+ if (role == RoleScript || role == RoleProject) {
+ this->AddScriptingCommands();
+ }
+ if (role == RoleProject) {
+ this->AddProjectCommands();
+ }
// Make sure we can capture the build tool output.
cmSystemTools::EnableVSConsoleOutput();
@@ -443,6 +447,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
cmSystemTools::Error("No cmake script provided.");
return false;
}
+ // Register fake project commands that hint misuse in script mode.
+ GetProjectCommandsInScriptMode(this->State);
this->ReadListFile(args, path.c_str());
} else if (arg.find("--find-package", 0) == 0) {
findPackageMode = true;
@@ -1888,7 +1894,7 @@ int cmake::CheckBuildSystem()
// Read the rerun check file and use it to decide whether to do the
// global generate.
- cmake cm;
+ cmake cm(RoleScript); // Actually, all we need is the `set` command.
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
@@ -2419,6 +2425,9 @@ int cmake::Build(const std::string& dir, const std::string& target,
std::string homeOutputOrig = this->GetHomeOutputDirectory();
this->SetDirectoriesFromFile(cachePath.c_str());
+ this->AddScriptingCommands();
+ this->AddProjectCommands();
+
int ret = this->Configure();
if (ret) {
cmSystemTools::Message("CMake Configure step failed. "
diff --git a/Source/cmake.h b/Source/cmake.h
index 16a2830..4ddacf7 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -58,6 +58,13 @@ class cmake
CM_DISABLE_COPY(cmake)
public:
+ enum Role
+ {
+ RoleInternal, // no commands
+ RoleScript, // script commands
+ RoleProject // all commands
+ };
+
enum MessageType
{
AUTHOR_WARNING,
@@ -112,7 +119,7 @@ public:
typedef std::map<std::string, cmInstalledFile> InstalledFilesMap;
/// Default constructor
- cmake();
+ cmake(Role role);
/// Destructor
~cmake();
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 3d11241..f472b8a 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -201,7 +201,7 @@ int do_cmake(int ac, char const* const* av)
doc.addCMakeStandardDocSections();
if (doc.CheckOptions(ac, av)) {
// Construct and print requested documentation.
- cmake hcm;
+ cmake hcm(cmake::RoleInternal);
hcm.SetHomeDirectory("");
hcm.SetHomeOutputDirectory("");
hcm.AddCMakePaths();
@@ -283,13 +283,13 @@ int do_cmake(int ac, char const* const* av)
}
}
if (sysinfo) {
- cmake cm;
+ cmake cm(cmake::RoleProject);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
int ret = cm.GetSystemInformation(args);
return ret;
}
- cmake cm;
+ cmake cm(cmake::RoleProject);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmSystemTools::SetMessageCallback(cmakemainMessageCallback, (void*)&cm);
@@ -407,7 +407,7 @@ static int do_build(int ac, char const* const* av)
return 1;
}
- cmake cm;
+ cmake cm(cmake::RoleInternal);
cmSystemTools::SetMessageCallback(cmakemainMessageCallback, (void*)&cm);
cm.SetProgressCallback(cmakemainProgressCallback, (void*)&cm);
return cm.Build(dir, target, config, nativeOptions, clean);
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index cc954e6..dc267e7 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -583,7 +583,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
std::cerr << "-E capabilities accepts no additional arguments\n";
return 1;
}
- cmake cm;
+ cmake cm(cmake::RoleInternal);
#if defined(HAVE_SERVER_MODE) && HAVE_SERVER_MODE
std::cout << cm.ReportCapabilities(true);
#else
@@ -760,7 +760,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
const bool verbose = isCMakeVerbose();
// Create a cmake object instance to process dependencies.
- cmake cm;
+ cmake cm(cmake::RoleScript); // All we need is the `set` command.
std::string gen;
std::string homeDir;
std::string startDir;
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 15d4cf4..84e815d 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -7,7 +7,6 @@
#include "cmCTest.h"
#include "cmDocumentation.h"
#include "cmSystemTools.h"
-#include "cmake.h"
#include "cmsys/Encoding.hxx"
#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
@@ -170,11 +169,6 @@ int main(int argc, char const* const* argv)
cmDocumentation doc;
doc.addCTestStandardDocSections();
if (doc.CheckOptions(argc, argv)) {
- cmake hcm;
- hcm.SetHomeDirectory("");
- hcm.SetHomeOutputDirectory("");
- hcm.AddCMakePaths();
-
// Construct and print requested documentation.
cmCTestScriptHandler* ch =
static_cast<cmCTestScriptHandler*>(inst.GetHandler("script"));
diff --git a/Tests/FindMPI/Test/CMakeLists.txt b/Tests/FindMPI/Test/CMakeLists.txt
index 6f177f9..3910c25 100644
--- a/Tests/FindMPI/Test/CMakeLists.txt
+++ b/Tests/FindMPI/Test/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
-project(TestFindMPI)
+project(TestFindMPI NONE)
include(CTest)
macro(source_code_mapper_helper LANG_NAME)
diff --git a/Tests/FindOpenMP/Test/CMakeLists.txt b/Tests/FindOpenMP/Test/CMakeLists.txt
index 6313ef6..2692947 100644
--- a/Tests/FindOpenMP/Test/CMakeLists.txt
+++ b/Tests/FindOpenMP/Test/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
-project(TestFindOpenMP)
+project(TestFindOpenMP NONE)
include(CTest)
macro(source_code_mapper_helper LANG_NAME SRC_FILE_NAME)
diff --git a/Tests/RunCMake/Ninja/CommandConcat.cmake b/Tests/RunCMake/Ninja/CommandConcat.cmake
new file mode 100644
index 0000000..790cf9d
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CommandConcat.cmake
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.7)
+project(concat_cmd NONE)
+set(output1 ${CMAKE_BINARY_DIR}/out1.txt)
+set(output2 ${CMAKE_BINARY_DIR}/out2.txt)
+file(REMOVE ${output1} ${output2})
+# Check that second command runs if first command contains "||" which has higher precedence than "&&" on Windows
+add_custom_target(concat_cmd ALL
+ COMMAND ${CMAKE_COMMAND} -E echo "Hello || pipe world" && ${CMAKE_COMMAND} -E touch ${output1} || exit 1
+ COMMAND ${CMAKE_COMMAND} -E touch ${output2})
+# Check output
+add_custom_target(check_output ALL
+ COMMAND ${CMAKE_COMMAND} -E copy ${output1} ${output1}.copy
+ COMMAND ${CMAKE_COMMAND} -E copy ${output2} ${output2}.copy)
+add_dependencies(check_output concat_cmd)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 8c3bc20..b3720fb 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -40,6 +40,16 @@ run_CMP0058(NEW-by)
run_cmake(CustomCommandDepfile)
+function(run_CommandConcat)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CommandConcat-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ run_cmake(CommandConcat)
+ run_cmake_command(CommandConcat-build ${CMAKE_COMMAND} --build .)
+endfunction()
+run_CommandConcat()
+
function(run_SubDir)
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SubDir-build)