ENH: Added INSTALL command as a placeholder for a future generic install specification interface. Currently it supports only a SCRIPT option specifying a script to run during the install stage.

This commit is contained in:
Brad King 2006-02-10 13:54:36 -05:00
parent d2621064e2
commit b8a33fb424
12 changed files with 212 additions and 3 deletions

View File

@ -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.")
)

View File

@ -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);

View File

@ -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;
}

80
Source/cmInstallCommand.h Normal file
View File

@ -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

View File

@ -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++)

View File

@ -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;

View File

@ -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)

View File

@ -0,0 +1,2 @@
MESSAGE("This is install script 1.")
SET(INSTALL_SCRIPT_1_DID_RUN 1)

View File

@ -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"
)

View File

@ -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)

View File

@ -0,0 +1,2 @@
MESSAGE("This is install script 1.")
SET(INSTALL_SCRIPT_1_DID_RUN 1)

View File

@ -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"
)