summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Docs/cmake-mode.el4
-rw-r--r--Source/cmCommands.cxx2
-rw-r--r--Source/cmInstallCommand.cxx54
-rw-r--r--Source/cmInstallCommand.h80
-rw-r--r--Source/cmLocalGenerator.cxx9
-rw-r--r--Source/cmMakefile.h10
-rw-r--r--Tests/SimpleInstall/CMakeLists.txt17
-rw-r--r--Tests/SimpleInstall/InstallScript1.cmake2
-rw-r--r--Tests/SimpleInstall/InstallScript2.cmake9
-rw-r--r--Tests/SimpleInstallS2/CMakeLists.txt17
-rw-r--r--Tests/SimpleInstallS2/InstallScript1.cmake2
-rw-r--r--Tests/SimpleInstallS2/InstallScript2.cmake9
12 files changed, 212 insertions, 3 deletions
diff --git a/Docs/cmake-mode.el b/Docs/cmake-mode.el
index a41818e..e13cb96 100644
--- a/Docs/cmake-mode.el
+++ b/Docs/cmake-mode.el
@@ -134,7 +134,7 @@
)
)
-; (regexp-opt '("ADD_CUSTOM_COMMAND" "ADD_CUSTOM_TARGET" "ADD_DEFINITIONS" "ADD_DEPENDENCIES" "ADD_SUBDIRECTORY" "ADD_EXECUTABLE" "ADD_LIBRARY" "ADD_TEST" "AUX_SOURCE_DIRECTORY" "BUILD_COMMAND" "BUILD_NAME" "CMAKE_MINIMUM_REQUIRED" "CONFIGURE_FILE" "CREATE_TEST_SOURCELIST" "CREATE_TEST_SOURCELIST " "ELSE" "ENABLE_TESTING" "ENABLE_TESTING " "ENDFOREACH" "ENDIF" "ENDMACRO" "ENDWHILE" "EXEC_PROGRAM" "EXECUTE_PROCESS" "EXPORT_LIBRARY_DEPENDENCIES" "FIND_FILE" "FIND_LIBRARY" "FIND_PACKAGE" "FIND_PATH" "FIND_PROGRAM" "FLTK_WRAP_UI" "FOREACH" "GET_CMAKE_PROPERTY" "GET_DIRECTORY_PROPERTY" "GET_FILENAME_COMPONENT" "GET_SOURCE_FILE_PROPERTY" "GET_TARGET_PROPERTY" "IF" "INCLUDE" "INCLUDE_DIRECTORIES" "INCLUDE_EXTERNAL_MSPROJECT" "INCLUDE_REGULAR_EXPRESSION" "INSTALL_FILES" "INSTALL_PROGRAMS" "INSTALL_TARGETS" "ITK_WRAP_TCL" "LINK_DIRECTORIES" "LINK_LIBRARIES" "LOAD_CACHE" "LOAD_COMMAND" "MACRO" "MAKE_DIRECTORY" "MARK_AS_ADVANCED" "MESSAGE" "OPTION" "OUTPUT_REQUIRED_FILES" "PROJECT" "QT_WRAP_CPP" "QT_WRAP_UI" "REMOVE" "SEPARATE_ARGUMENTS" "SET" "SET_DIRECTORY_PROPERTIES" "SET_SOURCE_FILES_PROPERTIES" "SET_TARGET_PROPERTIES" "SITE_NAME" "SOURCE_GROUP" "STRING" "SUBDIRS" "SUBDIR_DEPENDS" "TARGET_LINK_LIBRARIES" "TRY_COMPILE" "TRY_RUN" "USE_MANGLED_MESA" "UTILITY_SOURCE" "VARIABLE_REQUIRES" "VTK_MAKE_INSTANTIATOR" "VTK_MAKE_INSTANTIATOR " "VTK_WRAP_JAVA" "VTK_WRAP_PYTHON" "VTK_WRAP_TCL" "WHILE" "WRITE_FILE" "add_custom_command" "add_custom_target" "add_definitions" "add_dependencies" "add_subdirectory" "add_executable" "add_library" "add_test" "aux_source_directory" "build_command" "build_name" "cmake_minimum_required" "configure_file" "create_test_sourcelist" "create_test_sourcelist " "else" "enable_testing" "enable_testing " "endforeach" "endif" "endmacro" "endwhile" "exec_program" "export_library_dependencies" "find_file" "find_library" "find_package" "find_path" "find_program" "fltk_wrap_ui" "foreach" "get_cmake_property" "get_directory_property" "get_filename_component" "get_source_file_property" "get_target_property" "if" "include" "include_directories" "include_external_msproject" "include_regular_expression" "install_files" "install_programs" "install_targets" "itk_wrap_tcl" "link_directories" "link_libraries" "load_cache" "load_command" "macro" "make_directory" "mark_as_advanced" "message" "option" "output_required_files" "project" "qt_wrap_cpp" "qt_wrap_ui" "remove" "separate_arguments" "set" "set_directory_properties" "set_source_files_properties" "set_target_properties" "site_name" "source_group" "string" "subdirs" "subdir_depends" "target_link_libraries" "try_compile" "try_run" "use_mangled_mesa" "utility_source" "variable_requires" "vtk_make_instantiator" "vtk_make_instantiator " "vtk_wrap_java" "vtk_wrap_python" "vtk_wrap_tcl" "while" "write_file") t)
+; (regexp-opt '("ADD_CUSTOM_COMMAND" "ADD_CUSTOM_TARGET" "ADD_DEFINITIONS" "ADD_DEPENDENCIES" "ADD_SUBDIRECTORY" "ADD_EXECUTABLE" "ADD_LIBRARY" "ADD_TEST" "AUX_SOURCE_DIRECTORY" "BUILD_COMMAND" "BUILD_NAME" "CMAKE_MINIMUM_REQUIRED" "CONFIGURE_FILE" "CREATE_TEST_SOURCELIST" "CREATE_TEST_SOURCELIST " "ELSE" "ENABLE_TESTING" "ENABLE_TESTING " "ENDFOREACH" "ENDIF" "ENDMACRO" "ENDWHILE" "EXEC_PROGRAM" "EXECUTE_PROCESS" "EXPORT_LIBRARY_DEPENDENCIES" "FIND_FILE" "FIND_LIBRARY" "FIND_PACKAGE" "FIND_PATH" "FIND_PROGRAM" "FLTK_WRAP_UI" "FOREACH" "GET_CMAKE_PROPERTY" "GET_DIRECTORY_PROPERTY" "GET_FILENAME_COMPONENT" "GET_SOURCE_FILE_PROPERTY" "GET_TARGET_PROPERTY" "IF" "INCLUDE" "INCLUDE_DIRECTORIES" "INCLUDE_EXTERNAL_MSPROJECT" "INCLUDE_REGULAR_EXPRESSION" "INSTALL" "INSTALL_FILES" "INSTALL_PROGRAMS" "INSTALL_TARGETS" "ITK_WRAP_TCL" "LINK_DIRECTORIES" "LINK_LIBRARIES" "LOAD_CACHE" "LOAD_COMMAND" "MACRO" "MAKE_DIRECTORY" "MARK_AS_ADVANCED" "MESSAGE" "OPTION" "OUTPUT_REQUIRED_FILES" "PROJECT" "QT_WRAP_CPP" "QT_WRAP_UI" "REMOVE" "SEPARATE_ARGUMENTS" "SET" "SET_DIRECTORY_PROPERTIES" "SET_SOURCE_FILES_PROPERTIES" "SET_TARGET_PROPERTIES" "SITE_NAME" "SOURCE_GROUP" "STRING" "SUBDIRS" "SUBDIR_DEPENDS" "TARGET_LINK_LIBRARIES" "TRY_COMPILE" "TRY_RUN" "USE_MANGLED_MESA" "UTILITY_SOURCE" "VARIABLE_REQUIRES" "VTK_MAKE_INSTANTIATOR" "VTK_MAKE_INSTANTIATOR " "VTK_WRAP_JAVA" "VTK_WRAP_PYTHON" "VTK_WRAP_TCL" "WHILE" "WRITE_FILE" "add_custom_command" "add_custom_target" "add_definitions" "add_dependencies" "add_subdirectory" "add_executable" "add_library" "add_test" "aux_source_directory" "build_command" "build_name" "cmake_minimum_required" "configure_file" "create_test_sourcelist" "create_test_sourcelist " "else" "enable_testing" "enable_testing " "endforeach" "endif" "endmacro" "endwhile" "exec_program" "export_library_dependencies" "find_file" "find_library" "find_package" "find_path" "find_program" "fltk_wrap_ui" "foreach" "get_cmake_property" "get_directory_property" "get_filename_component" "get_source_file_property" "get_target_property" "if" "include" "include_directories" "include_external_msproject" "include_regular_expression" "install_files" "install_programs" "install_targets" "itk_wrap_tcl" "link_directories" "link_libraries" "load_cache" "load_command" "macro" "make_directory" "mark_as_advanced" "message" "option" "output_required_files" "project" "qt_wrap_cpp" "qt_wrap_ui" "remove" "separate_arguments" "set" "set_directory_properties" "set_source_files_properties" "set_target_properties" "site_name" "source_group" "string" "subdirs" "subdir_depends" "target_link_libraries" "try_compile" "try_run" "use_mangled_mesa" "utility_source" "variable_requires" "vtk_make_instantiator" "vtk_make_instantiator " "vtk_wrap_java" "vtk_wrap_python" "vtk_wrap_tcl" "while" "write_file") t)
; run the above in the scatch buffer to generate the string that
; goes in (list '("the regexp string" . font-lock-function-name-face)
; the string will be available in the *Messages* buffer
@@ -143,7 +143,7 @@
(defconst cmake-font-lock-defaults
(list
;; '("(" . font-lock-keyword-face)
- '("\\(A\\(?:DD_\\(?:CUSTOM_\\(?:COMMAND\\|TARGET\\)\\|DE\\(?:\\(?:FINITION\\|PENDENCIE\\)S\\)\\|EXECUTABLE\\|LIBRARY\\|SUBDIRECTORY\\|TEST\\)\\|UX_SOURCE_DIRECTORY\\)\\|BUILD_\\(?:COMMAND\\|NAME\\)\\|C\\(?:MAKE_MINIMUM_REQUIRED\\|ONFIGURE_FILE\\|REATE_TEST_SOURCELIST ?\\)\\|E\\(?:LSE\\|N\\(?:ABLE_TESTING ?\\|D\\(?:FOREACH\\|IF\\|MACRO\\|WHILE\\)\\)\\|X\\(?:EC\\(?:UTE_PROCESS\\|_PROGRAM\\)\\|PORT_LIBRARY_DEPENDENCIES\\)\\)\\|F\\(?:IND_\\(?:FILE\\|LIBRARY\\|P\\(?:A\\(?:CKAGE\\|TH\\)\\|ROGRAM\\)\\)\\|LTK_WRAP_UI\\|OREACH\\)\\|GET_\\(?:CMAKE_PROPERTY\\|DIRECTORY_PROPERTY\\|FILENAME_COMPONENT\\|\\(?:SOURCE_FILE\\|TARGET\\)_PROPERTY\\)\\|I\\(?:F\\|N\\(?:CLUDE\\(?:_\\(?:DIRECTORIES\\|EXTERNAL_MSPROJECT\\|REGULAR_EXPRESSION\\)\\)?\\|STALL_\\(?:\\(?:FILE\\|PROGRAM\\|TARGET\\)S\\)\\)\\|TK_WRAP_TCL\\)\\|L\\(?:INK_\\(?:\\(?:DIRECTO\\|LIBRA\\)RIES\\)\\|OAD_C\\(?:ACHE\\|OMMAND\\)\\)\\|M\\(?:A\\(?:CRO\\|KE_DIRECTORY\\|RK_AS_ADVANCED\\)\\|ESSAGE\\)\\|O\\(?:PTION\\|UTPUT_REQUIRED_FILES\\)\\|PROJECT\\|QT_WRAP_\\(?:CPP\\|UI\\)\\|REMOVE\\|S\\(?:E\\(?:PARATE_ARGUMENTS\\|T\\(?:_\\(?:\\(?:DIRECTORY\\|SOURCE_FILES\\|TARGET\\)_PROPERTIES\\)\\)?\\)\\|ITE_NAME\\|OURCE_GROUP\\|TRING\\|UBDIR\\(?:\\(?:_DEPEND\\)?S\\)\\)\\|T\\(?:ARGET_LINK_LIBRARIES\\|RY_\\(?:COMPILE\\|RUN\\)\\)\\|U\\(?:SE_MANGLED_MESA\\|TILITY_SOURCE\\)\\|V\\(?:ARIABLE_REQUIRES\\|TK_\\(?:MAKE_INSTANTIATOR ?\\|WRAP_\\(?:JAVA\\|PYTHON\\|TCL\\)\\)\\)\\|W\\(?:\\(?:H\\|RITE_F\\)ILE\\)\\|a\\(?:dd_\\(?:custom_\\(?:command\\|target\\)\\|de\\(?:\\(?:finition\\|pendencie\\)s\\)\\|executable\\|library\\|subdirectory\\|test\\)\\|ux_source_directory\\)\\|build_\\(?:command\\|name\\)\\|c\\(?:make_minimum_required\\|onfigure_file\\|reate_test_sourcelist ?\\)\\|e\\(?:lse\\|n\\(?:able_testing ?\\|d\\(?:foreach\\|if\\|macro\\|while\\)\\)\\|x\\(?:ec_program\\|port_library_dependencies\\)\\)\\|f\\(?:ind_\\(?:file\\|library\\|p\\(?:a\\(?:ckage\\|th\\)\\|rogram\\)\\)\\|ltk_wrap_ui\\|oreach\\)\\|get_\\(?:cmake_property\\|directory_property\\|filename_component\\|\\(?:source_file\\|target\\)_property\\)\\|i\\(?:f\\|n\\(?:clude\\(?:_\\(?:directories\\|external_msproject\\|regular_expression\\)\\)?\\|stall_\\(?:\\(?:file\\|program\\|target\\)s\\)\\)\\|tk_wrap_tcl\\)\\|l\\(?:ink_\\(?:\\(?:directo\\|libra\\)ries\\)\\|oad_c\\(?:ache\\|ommand\\)\\)\\|m\\(?:a\\(?:cro\\|ke_directory\\|rk_as_advanced\\)\\|essage\\)\\|o\\(?:ption\\|utput_required_files\\)\\|project\\|qt_wrap_\\(?:cpp\\|ui\\)\\|remove\\|s\\(?:e\\(?:parate_arguments\\|t\\(?:_\\(?:\\(?:directory\\|source_files\\|target\\)_properties\\)\\)?\\)\\|ite_name\\|ource_group\\|tring\\|ubdir\\(?:\\(?:_depend\\)?s\\)\\)\\|t\\(?:arget_link_libraries\\|ry_\\(?:compile\\|run\\)\\)\\|u\\(?:se_mangled_mesa\\|tility_source\\)\\|v\\(?:ariable_requires\\|tk_\\(?:make_instantiator ?\\|wrap_\\(?:java\\|python\\|tcl\\)\\)\\)\\|w\\(?:\\(?:h\\|rite_f\\)ile\\)\\)" . font-lock-function-name-face)
+ '("\\(A\\(?:DD_\\(?:CUSTOM_\\(?:COMMAND\\|TARGET\\)\\|DE\\(?:\\(?:FINITION\\|PENDENCIE\\)S\\)\\|EXECUTABLE\\|LIBRARY\\|SUBDIRECTORY\\|TEST\\)\\|UX_SOURCE_DIRECTORY\\)\\|BUILD_\\(?:COMMAND\\|NAME\\)\\|C\\(?:MAKE_MINIMUM_REQUIRED\\|ONFIGURE_FILE\\|REATE_TEST_SOURCELIST ?\\)\\|E\\(?:LSE\\|N\\(?:ABLE_TESTING ?\\|D\\(?:FOREACH\\|IF\\|MACRO\\|WHILE\\)\\)\\|X\\(?:EC\\(?:UTE_PROCESS\\|_PROGRAM\\)\\|PORT_LIBRARY_DEPENDENCIES\\)\\)\\|F\\(?:IND_\\(?:FILE\\|LIBRARY\\|P\\(?:A\\(?:CKAGE\\|TH\\)\\|ROGRAM\\)\\)\\|LTK_WRAP_UI\\|OREACH\\)\\|GET_\\(?:CMAKE_PROPERTY\\|DIRECTORY_PROPERTY\\|FILENAME_COMPONENT\\|\\(?:SOURCE_FILE\\|TARGET\\)_PROPERTY\\)\\|I\\(?:F\\|N\\(?:CLUDE\\(?:_\\(?:DIRECTORIES\\|EXTERNAL_MSPROJECT\\|REGULAR_EXPRESSION\\)\\)?\\|STALL\\(?:_\\(?:\\(?:FILE\\|PROGRAM\\|TARGET\\)S\\)\\)?\\)\\|TK_WRAP_TCL\\)\\|L\\(?:INK_\\(?:\\(?:DIRECTO\\|LIBRA\\)RIES\\)\\|OAD_C\\(?:ACHE\\|OMMAND\\)\\)\\|M\\(?:A\\(?:CRO\\|KE_DIRECTORY\\|RK_AS_ADVANCED\\)\\|ESSAGE\\)\\|O\\(?:PTION\\|UTPUT_REQUIRED_FILES\\)\\|PROJECT\\|QT_WRAP_\\(?:CPP\\|UI\\)\\|REMOVE\\|S\\(?:E\\(?:PARATE_ARGUMENTS\\|T\\(?:_\\(?:\\(?:DIRECTORY\\|SOURCE_FILES\\|TARGET\\)_PROPERTIES\\)\\)?\\)\\|ITE_NAME\\|OURCE_GROUP\\|TRING\\|UBDIR\\(?:\\(?:_DEPEND\\)?S\\)\\)\\|T\\(?:ARGET_LINK_LIBRARIES\\|RY_\\(?:COMPILE\\|RUN\\)\\)\\|U\\(?:SE_MANGLED_MESA\\|TILITY_SOURCE\\)\\|V\\(?:ARIABLE_REQUIRES\\|TK_\\(?:MAKE_INSTANTIATOR ?\\|WRAP_\\(?:JAVA\\|PYTHON\\|TCL\\)\\)\\)\\|W\\(?:\\(?:H\\|RITE_F\\)ILE\\)\\|a\\(?:dd_\\(?:custom_\\(?:command\\|target\\)\\|de\\(?:\\(?:finition\\|pendencie\\)s\\)\\|executable\\|library\\|subdirectory\\|test\\)\\|ux_source_directory\\)\\|build_\\(?:command\\|name\\)\\|c\\(?:make_minimum_required\\|onfigure_file\\|reate_test_sourcelist ?\\)\\|e\\(?:lse\\|n\\(?:able_testing ?\\|d\\(?:foreach\\|if\\|macro\\|while\\)\\)\\|x\\(?:ec_program\\|port_library_dependencies\\)\\)\\|f\\(?:ind_\\(?:file\\|library\\|p\\(?:a\\(?:ckage\\|th\\)\\|rogram\\)\\)\\|ltk_wrap_ui\\|oreach\\)\\|get_\\(?:cmake_property\\|directory_property\\|filename_component\\|\\(?:source_file\\|target\\)_property\\)\\|i\\(?:f\\|n\\(?:clude\\(?:_\\(?:directories\\|external_msproject\\|regular_expression\\)\\)?\\|stall_\\(?:\\(?:file\\|program\\|target\\)s\\)\\)\\|tk_wrap_tcl\\)\\|l\\(?:ink_\\(?:\\(?:directo\\|libra\\)ries\\)\\|oad_c\\(?:ache\\|ommand\\)\\)\\|m\\(?:a\\(?:cro\\|ke_directory\\|rk_as_advanced\\)\\|essage\\)\\|o\\(?:ption\\|utput_required_files\\)\\|project\\|qt_wrap_\\(?:cpp\\|ui\\)\\|remove\\|s\\(?:e\\(?:parate_arguments\\|t\\(?:_\\(?:\\(?:directory\\|source_files\\|target\\)_properties\\)\\)?\\)\\|ite_name\\|ource_group\\|tring\\|ubdir\\(?:\\(?:_depend\\)?s\\)\\)\\|t\\(?:arget_link_libraries\\|ry_\\(?:compile\\|run\\)\\)\\|u\\(?:se_mangled_mesa\\|tility_source\\)\\|v\\(?:ariable_requires\\|tk_\\(?:make_instantiator ?\\|wrap_\\(?:java\\|python\\|tcl\\)\\)\\)\\|w\\(?:\\(?:h\\|rite_f\\)ile\\)\\)" . font-lock-function-name-face)
"Highlighting expressions for CMAKE mode.")
)
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 88b06c2..22d4e32 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -26,6 +26,7 @@
#include "cmGetDirectoryPropertyCommand.cxx"
#include "cmGetTestPropertyCommand.cxx"
#include "cmIncludeExternalMSProjectCommand.cxx"
+#include "cmInstallCommand.cxx"
#include "cmLinkLibrariesCommand.cxx"
#include "cmLoadCacheCommand.cxx"
#include "cmMathCommand.cxx"
@@ -68,6 +69,7 @@ void GetPredefinedCommands(std::list<cmCommand*>&
commands.push_back(new cmGetDirectoryPropertyCommand);
commands.push_back(new cmGetTestPropertyCommand);
commands.push_back(new cmIncludeExternalMSProjectCommand);
+ commands.push_back(new cmInstallCommand);
commands.push_back(new cmLinkLibrariesCommand);
commands.push_back(new cmLoadCacheCommand);
commands.push_back(new cmLoadCommandCommand);
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
new file mode 100644
index 0000000..97f12ca
--- /dev/null
+++ b/Source/cmInstallCommand.cxx
@@ -0,0 +1,54 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "cmInstallCommand.h"
+
+// cmInstallCommand
+bool cmInstallCommand::InitialPass(std::vector<std::string> const& args)
+{
+ bool doing_script = false;
+ for(size_t i=0; i < args.size(); ++i)
+ {
+ if(args[i] == "SCRIPT")
+ {
+ doing_script = true;
+ }
+ else if(doing_script)
+ {
+ doing_script = false;
+ std::string script = args[i];
+ if(!cmSystemTools::FileIsFullPath(script.c_str()))
+ {
+ script = m_Makefile->GetCurrentDirectory();
+ script += "/";
+ script += args[i];
+ }
+ if(cmSystemTools::FileIsDirectory(script.c_str()))
+ {
+ this->SetError("given a directory as value of SCRIPT argument.");
+ return false;
+ }
+ m_Makefile->AddInstallScript(script.c_str());
+ }
+ }
+ if(doing_script)
+ {
+ this->SetError("given no value for SCRIPT argument.");
+ return false;
+ }
+
+ return true;
+}
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
new file mode 100644
index 0000000..789cc79
--- /dev/null
+++ b/Source/cmInstallCommand.h
@@ -0,0 +1,80 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmInstallCommand_h
+#define cmInstallCommand_h
+
+#include "cmCommand.h"
+
+/** \class cmInstallCommand
+ * \brief Specifies where to install some files
+ *
+ * cmInstallCommand is a general-purpose interface command for
+ * specifying install rules.
+ */
+class cmInstallCommand : public cmCommand
+{
+public:
+ /**
+ * This is a virtual constructor for the command.
+ */
+ virtual cmCommand* Clone()
+ {
+ return new cmInstallCommand;
+ }
+
+ /**
+ * This is called when the command is first encountered in
+ * the CMakeLists.txt file.
+ */
+ virtual bool InitialPass(std::vector<std::string> const& args);
+
+ /**
+ * The name of the command as specified in CMakeList.txt.
+ */
+ virtual const char* GetName() { return "INSTALL";}
+
+ /**
+ * Succinct documentation.
+ */
+ virtual const char* GetTerseDocumentation()
+ {
+ return "Install rule specification interface command.";
+ }
+
+ /**
+ * More documentation.
+ */
+ virtual const char* GetFullDocumentation()
+ {
+ return
+ " INSTALL(SCRIPT <script1> [SCRIPT <script2> [...]])\n"
+ "Specify rules to run at install time. If SCRIPT is given the "
+ "file named after it will be included in the install scripts. "
+ "Multiple SCRIPTs may be given within a single source directory "
+ "and the scripts will be run in the order given. "
+ "The processing order of these scripts relative to install rules "
+ "generated by INSTALL_TARGETS, INSTALL_FILES, and INSTALL_PROGRAMS "
+ "commands is not specified.\n"
+ "This command is a placeholder for a future larger interface."
+ ;
+ }
+
+ cmTypeMacro(cmInstallCommand, cmCommand);
+};
+
+
+#endif
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 04ae274..4a95ca1 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -354,6 +354,15 @@ void cmLocalGenerator::GenerateInstallRules()
exeOutPath = currdir + "/";
}
+ // Include user-specified install scripts.
+ std::vector<std::string> const& installScripts =
+ m_Makefile->GetInstallScripts();
+ for(std::vector<std::string>::const_iterator s = installScripts.begin();
+ s != installScripts.end(); ++s)
+ {
+ fout << "INCLUDE(\"" << s->c_str() << "\")" << std::endl;
+ }
+
std::string destination;
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index f6418ba..cdd0adc 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -671,7 +671,12 @@ public:
///! Set/Get the preorder flag
void SetPreOrder(bool p) { this->PreOrder = p; }
bool GetPreOrder() { return this->PreOrder; }
-
+
+ /** Add a script file to be invoked during installation. */
+ void AddInstallScript(const char* script)
+ { m_InstallScripts.push_back(script); }
+ std::vector<std::string> const& GetInstallScripts()
+ { return m_InstallScripts; }
protected:
// add link libraries and directories to the target
void AddGlobalLinkInformation(const char* name, cmTarget& target);
@@ -704,6 +709,9 @@ protected:
cmTarget::LinkLibraries m_LinkLibraries;
+ // List of install-time scripts. This should not be inherited.
+ std::vector<std::string> m_InstallScripts;
+
std::string m_IncludeFileRegularExpression;
std::string m_ComplainFileRegularExpression;
std::vector<std::string> m_SourceFileExtensions;
diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt
index 592cc6b..b238b87 100644
--- a/Tests/SimpleInstall/CMakeLists.txt
+++ b/Tests/SimpleInstall/CMakeLists.txt
@@ -19,6 +19,15 @@ IF(STAGE2)
SET(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX})
SET(t4NAMES test4 test4${CMAKE_DEBUG_POSTFIX})
+ # Make sure the install script ran.
+ SET(CMAKE_INSTALL_SCRIPT_DID_RUN 0)
+ INCLUDE(${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake OPTIONAL)
+ IF(CMAKE_INSTALL_SCRIPT_DID_RUN)
+ MESSAGE(STATUS "Stage 1 did run install script 2.")
+ ELSE(CMAKE_INSTALL_SCRIPT_DID_RUN)
+ MESSAGE(SEND_ERROR "Stage 1 did not run install script 2.")
+ ENDIF(CMAKE_INSTALL_SCRIPT_DID_RUN)
+
IF(CYGWIN OR MINGW)
SET(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/bin")
ENDIF(CYGWIN OR MINGW)
@@ -70,6 +79,14 @@ ELSE(STAGE2)
INSTALL_TARGETS(/lib test1 test2 test3 test4)
INSTALL_FILES(/include FILES lib1.h lib2.h lib3.h)
+ # Test user-specified install scripts.
+ INSTALL(
+ SCRIPT InstallScript1.cmake
+ SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript2.cmake
+ )
+ SET_DIRECTORY_PROPERTIES(PROPERTIES
+ ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake)
+
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstallExe)
# Disable VERSION test until it is implemented in the XCode generator.
#SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2)
diff --git a/Tests/SimpleInstall/InstallScript1.cmake b/Tests/SimpleInstall/InstallScript1.cmake
new file mode 100644
index 0000000..7ce8551
--- /dev/null
+++ b/Tests/SimpleInstall/InstallScript1.cmake
@@ -0,0 +1,2 @@
+MESSAGE("This is install script 1.")
+SET(INSTALL_SCRIPT_1_DID_RUN 1)
diff --git a/Tests/SimpleInstall/InstallScript2.cmake b/Tests/SimpleInstall/InstallScript2.cmake
new file mode 100644
index 0000000..fdbce81
--- /dev/null
+++ b/Tests/SimpleInstall/InstallScript2.cmake
@@ -0,0 +1,9 @@
+MESSAGE("This is install script 2.")
+IF(INSTALL_SCRIPT_1_DID_RUN)
+ MESSAGE("Install script ordering works.")
+ELSE(INSTALL_SCRIPT_1_DID_RUN)
+ MESSAGE(FATAL_ERROR "Install script 1 did not run before install script 2.")
+ENDIF(INSTALL_SCRIPT_1_DID_RUN)
+FILE(WRITE "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake"
+ "SET(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n"
+ )
diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt
index 592cc6b..b238b87 100644
--- a/Tests/SimpleInstallS2/CMakeLists.txt
+++ b/Tests/SimpleInstallS2/CMakeLists.txt
@@ -19,6 +19,15 @@ IF(STAGE2)
SET(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX})
SET(t4NAMES test4 test4${CMAKE_DEBUG_POSTFIX})
+ # Make sure the install script ran.
+ SET(CMAKE_INSTALL_SCRIPT_DID_RUN 0)
+ INCLUDE(${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake OPTIONAL)
+ IF(CMAKE_INSTALL_SCRIPT_DID_RUN)
+ MESSAGE(STATUS "Stage 1 did run install script 2.")
+ ELSE(CMAKE_INSTALL_SCRIPT_DID_RUN)
+ MESSAGE(SEND_ERROR "Stage 1 did not run install script 2.")
+ ENDIF(CMAKE_INSTALL_SCRIPT_DID_RUN)
+
IF(CYGWIN OR MINGW)
SET(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/bin")
ENDIF(CYGWIN OR MINGW)
@@ -70,6 +79,14 @@ ELSE(STAGE2)
INSTALL_TARGETS(/lib test1 test2 test3 test4)
INSTALL_FILES(/include FILES lib1.h lib2.h lib3.h)
+ # Test user-specified install scripts.
+ INSTALL(
+ SCRIPT InstallScript1.cmake
+ SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript2.cmake
+ )
+ SET_DIRECTORY_PROPERTIES(PROPERTIES
+ ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake)
+
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstallExe)
# Disable VERSION test until it is implemented in the XCode generator.
#SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2)
diff --git a/Tests/SimpleInstallS2/InstallScript1.cmake b/Tests/SimpleInstallS2/InstallScript1.cmake
new file mode 100644
index 0000000..7ce8551
--- /dev/null
+++ b/Tests/SimpleInstallS2/InstallScript1.cmake
@@ -0,0 +1,2 @@
+MESSAGE("This is install script 1.")
+SET(INSTALL_SCRIPT_1_DID_RUN 1)
diff --git a/Tests/SimpleInstallS2/InstallScript2.cmake b/Tests/SimpleInstallS2/InstallScript2.cmake
new file mode 100644
index 0000000..fdbce81
--- /dev/null
+++ b/Tests/SimpleInstallS2/InstallScript2.cmake
@@ -0,0 +1,9 @@
+MESSAGE("This is install script 2.")
+IF(INSTALL_SCRIPT_1_DID_RUN)
+ MESSAGE("Install script ordering works.")
+ELSE(INSTALL_SCRIPT_1_DID_RUN)
+ MESSAGE(FATAL_ERROR "Install script 1 did not run before install script 2.")
+ENDIF(INSTALL_SCRIPT_1_DID_RUN)
+FILE(WRITE "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake"
+ "SET(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n"
+ )