diff options
405 files changed, 4489 insertions, 2778 deletions
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index 7458a66..51663a8 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -259,7 +259,9 @@ the indentation. Otherwise it retains the same position on the line" (setq comment-start "#") ; Run user hooks. - (run-hooks 'cmake-mode-hook)) + (if (boundp 'prog-mode-hook) + (run-hooks 'prog-mode-hook 'cmake-mode-hook) + (run-hooks 'cmake-mode-hook))) ; Help mode starts here diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt index 9358329..bd4d295 100644 --- a/Help/command/FIND_XXX.txt +++ b/Help/command/FIND_XXX.txt @@ -33,36 +33,47 @@ and the search will not be repeated unless the variable is cleared. If nothing is found, the result will be ``<VAR>-NOTFOUND``, and the search will be attempted again the next time |FIND_XXX| is invoked with the same variable. -The name of the |SEARCH_XXX| that -is searched for is specified by the names listed -after the NAMES argument. Additional search locations -can be specified after the PATHS argument. If ENV var is -found in the HINTS or PATHS section the environment variable var -will be read and converted from a system environment variable to -a cmake style list of paths. For example ENV PATH would be a way -to list the system path variable. The argument -after DOC will be used for the documentation string in -the cache. -PATH_SUFFIXES specifies additional subdirectories to check below -each search path. - -If NO_DEFAULT_PATH is specified, then no additional paths are + +Options include: + +``NAMES`` + Specify one or more possible names for the |SEARCH_XXX|. + + When using this to specify names with and without a version + suffix, we recommend specifying the unversioned name first + so that locally-built packages can be found before those + provided by distributions. + +``HINTS``, ``PATHS`` + Specify directories to search in addition to the default locations. + The ``ENV var`` sub-option reads paths from a system environment + variable. + +``PATH_SUFFIXES`` + Specify additional subdirectories to check below each directory + location otherwise considered. + +``DOC`` + Specify the documentation string for the ``<VAR>`` cache entry. + +If ``NO_DEFAULT_PATH`` is specified, then no additional paths are added to the search. -If NO_DEFAULT_PATH is not specified, the search process is as follows: +If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: .. |CMAKE_PREFIX_PATH_XXX_SUBDIR| replace:: - <prefix>/|XXX_SUBDIR| for each <prefix> in CMAKE_PREFIX_PATH + |prefix_XXX_SUBDIR| for each ``<prefix>`` in :variable:`CMAKE_PREFIX_PATH` .. |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR| replace:: - <prefix>/|XXX_SUBDIR| for each <prefix>/[s]bin in PATH, and - <entry>/|XXX_SUBDIR| for other entries in PATH + |prefix_XXX_SUBDIR| for each ``<prefix>/[s]bin`` in ``PATH``, and + |entry_XXX_SUBDIR| for other entries in ``PATH`` .. |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| replace:: - <prefix>/|XXX_SUBDIR| for each <prefix> in CMAKE_SYSTEM_PREFIX_PATH + |prefix_XXX_SUBDIR| for each ``<prefix>`` in + :variable:`CMAKE_SYSTEM_PREFIX_PATH` 1. Search paths specified in cmake-specific cache variables. - These are intended to be used on the command line with a -DVAR=value. - This can be skipped if NO_CMAKE_PATH is passed. + These are intended to be used on the command line with a ``-DVAR=value``. + This can be skipped if ``NO_CMAKE_PATH`` is passed. * |CMAKE_PREFIX_PATH_XXX| * |CMAKE_XXX_PATH| @@ -70,24 +81,24 @@ If NO_DEFAULT_PATH is not specified, the search process is as follows: 2. Search paths specified in cmake-specific environment variables. These are intended to be set in the user's shell configuration. - This can be skipped if NO_CMAKE_ENVIRONMENT_PATH is passed. + This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed. * |CMAKE_PREFIX_PATH_XXX| * |CMAKE_XXX_PATH| * |CMAKE_XXX_MAC_PATH| -3. Search the paths specified by the HINTS option. +3. Search the paths specified by the ``HINTS`` option. These should be paths computed by system introspection, such as a hint provided by the location of another item already found. - Hard-coded guesses should be specified with the PATHS option. + Hard-coded guesses should be specified with the ``PATHS`` option. 4. Search the standard system environment variables. - This can be skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument. + This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is an argument. * |SYSTEM_ENVIRONMENT_PATH_XXX| 5. Search cmake variables defined in the Platform files - for the current system. This can be skipped if NO_CMAKE_SYSTEM_PATH + for the current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is passed. * |CMAKE_SYSTEM_PREFIX_PATH_XXX| @@ -100,6 +111,9 @@ If NO_DEFAULT_PATH is not specified, the search process is as follows: .. |FIND_ARGS_XXX| replace:: <VAR> NAMES name -.. include:: FIND_XXX_MAC.txt +On OS X the :variable:`CMAKE_FIND_FRAMEWORK` and +:variable:`CMAKE_FIND_APPBUNDLE` variables determine the order of +preference between Apple-style and unix-style package components. + .. include:: FIND_XXX_ROOT.txt .. include:: FIND_XXX_ORDER.txt diff --git a/Help/command/FIND_XXX_MAC.txt b/Help/command/FIND_XXX_MAC.txt deleted file mode 100644 index eb3900c..0000000 --- a/Help/command/FIND_XXX_MAC.txt +++ /dev/null @@ -1,24 +0,0 @@ -On Darwin or systems supporting OS X Frameworks, the cmake variable -CMAKE_FIND_FRAMEWORK can be set to empty or one of the following: - -* FIRST: Try to find frameworks before standard libraries or headers. - This is the default on Darwin. - -* LAST: Try to find frameworks after standard libraries or headers. - -* ONLY: Only try to find frameworks. - -* NEVER: Never try to find frameworks. - -On Darwin or systems supporting OS X Application Bundles, the cmake -variable CMAKE_FIND_APPBUNDLE can be set to empty or one of the -following: - -* FIRST: Try to find application bundles before standard programs. - This is the default on Darwin. - -* LAST: Try to find application bundles after standard programs. - -* ONLY: Only try to find application bundles. - -* NEVER: Never try to find application bundles. diff --git a/Help/command/FIND_XXX_ROOT.txt b/Help/command/FIND_XXX_ROOT.txt index b5cab68..fab2303 100644 --- a/Help/command/FIND_XXX_ROOT.txt +++ b/Help/command/FIND_XXX_ROOT.txt @@ -16,8 +16,14 @@ search there too. By default at first the directories listed in directory is searched, and then the non-rooted directories will be searched. The default behavior can be adjusted by setting |CMAKE_FIND_ROOT_PATH_MODE_XXX|. This behavior can be manually -overridden on a per-call basis. By using CMAKE_FIND_ROOT_PATH_BOTH -the search order will be as described above. If -NO_CMAKE_FIND_ROOT_PATH is used then :variable:`CMAKE_FIND_ROOT_PATH` will not be -used. If ONLY_CMAKE_FIND_ROOT_PATH is used then only the re-rooted -directories and directories below :variable:`CMAKE_STAGING_PREFIX` will be searched. +overridden on a per-call basis using options: + +``CMAKE_FIND_ROOT_PATH_BOTH`` + Search in the order described above. + +``NO_CMAKE_FIND_ROOT_PATH`` + Do not use the :variable:`CMAKE_FIND_ROOT_PATH` variable. + +``ONLY_CMAKE_FIND_ROOT_PATH`` + Search only the re-rooted directories and directories below + :variable:`CMAKE_STAGING_PREFIX`. diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index e646c56..ecbf9dd 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -79,6 +79,9 @@ The options are: If ``COMMAND`` specifies an executable target (created by the :command:`add_executable` command) it will automatically be replaced by the location of the executable created at build time. + (Use the ``TARGET_FILE`` + :manual:`generator expression <cmake-generator-expressions(7)>` to + reference an executable later in the command line.) Additionally a target-level dependency will be added so that the executable target will be built before any target using this custom command. However this does NOT add a file-level dependency that diff --git a/Help/command/add_subdirectory.rst b/Help/command/add_subdirectory.rst index 29b5017..e979253 100644 --- a/Help/command/add_subdirectory.rst +++ b/Help/command/add_subdirectory.rst @@ -12,23 +12,23 @@ Add a subdirectory to the build. The source_dir specifies the directory in which the source CMakeLists.txt and code files are located. If it is a relative path it will be evaluated with respect to the current directory (the typical usage), but it may also be an -absolute path. The binary_dir specifies the directory in which to +absolute path. The ``binary_dir`` specifies the directory in which to place the output files. If it is a relative path it will be evaluated with respect to the current output directory, but it may also be an -absolute path. If binary_dir is not specified, the value of -source_dir, before expanding any relative path, will be used (the +absolute path. If ``binary_dir`` is not specified, the value of +``source_dir``, before expanding any relative path, will be used (the typical usage). The CMakeLists.txt file in the specified source directory will be processed immediately by CMake before processing in the current input file continues beyond this command. -If the EXCLUDE_FROM_ALL argument is provided then targets in the -subdirectory will not be included in the ALL target of the parent +If the ``EXCLUDE_FROM_ALL`` argument is provided then targets in the +subdirectory will not be included in the ``ALL`` target of the parent directory by default, and will be excluded from IDE project files. Users must explicitly build targets in the subdirectory. This is meant for use when the subdirectory contains a separate part of the project that is useful but not necessary, such as a set of examples. -Typically the subdirectory should contain its own project() command -invocation so that a full build system will be generated in the +Typically the subdirectory should contain its own :command:`project` +command invocation so that a full build system will be generated in the subdirectory (such as a VS IDE solution file). Note that inter-target dependencies supercede this exclusion. If a target built by the parent project depends on a target in the subdirectory, the dependee diff --git a/Help/command/aux_source_directory.rst b/Help/command/aux_source_directory.rst index 434d7a9..dcd1cdf 100644 --- a/Help/command/aux_source_directory.rst +++ b/Help/command/aux_source_directory.rst @@ -8,7 +8,7 @@ Find all source files in a directory. aux_source_directory(<dir> <variable>) Collects the names of all the source files in the specified directory -and stores the list in the <variable> provided. This command is +and stores the list in the ``<variable>`` provided. This command is intended to be used by projects that use explicit template instantiation. Template instantiation files can be stored in a "Templates" subdirectory and collected automatically using this diff --git a/Help/command/build_name.rst b/Help/command/build_name.rst index 53cd05e..f717db1 100644 --- a/Help/command/build_name.rst +++ b/Help/command/build_name.rst @@ -3,7 +3,7 @@ build_name Disallowed. See CMake Policy :policy:`CMP0036`. -Use ${CMAKE_SYSTEM} and ${CMAKE_CXX_COMPILER} instead. +Use ``${CMAKE_SYSTEM}`` and ``${CMAKE_CXX_COMPILER}`` instead. :: @@ -11,4 +11,5 @@ Use ${CMAKE_SYSTEM} and ${CMAKE_CXX_COMPILER} instead. Sets the specified variable to a string representing the platform and compiler settings. These values are now available through the -CMAKE_SYSTEM and CMAKE_CXX_COMPILER variables. +:variable:`CMAKE_SYSTEM` and +:variable:`CMAKE_CXX_COMPILER <CMAKE_<LANG>_COMPILER>` variables. diff --git a/Help/command/cmake_host_system_information.rst b/Help/command/cmake_host_system_information.rst index ba545d5..9402d57 100644 --- a/Help/command/cmake_host_system_information.rst +++ b/Help/command/cmake_host_system_information.rst @@ -8,10 +8,10 @@ Query host system specific information. cmake_host_system_information(RESULT <variable> QUERY <key> ...) Queries system information of the host system on which cmake runs. -One or more <key> can be provided to select the information to be -queried. The list of queried values is stored in <variable>. +One or more ``<key>`` can be provided to select the information to be +queried. The list of queried values is stored in ``<variable>``. -<key> can be one of the following values: +``<key>`` can be one of the following values: :: diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst index 9865eeb..8573218 100644 --- a/Help/command/cmake_minimum_required.rst +++ b/Help/command/cmake_minimum_required.rst @@ -25,7 +25,7 @@ When version 2.4 or lower is given the command implicitly invokes which enables compatibility features for CMake 2.4 and lower. -The FATAL_ERROR option is accepted but ignored by CMake 2.6 and +The ``FATAL_ERROR`` option is accepted but ignored by CMake 2.6 and higher. It should be specified so CMake versions 2.4 and lower fail with an error instead of just a warning. diff --git a/Help/command/cmake_policy.rst b/Help/command/cmake_policy.rst index 2bc3287..b51b951 100644 --- a/Help/command/cmake_policy.rst +++ b/Help/command/cmake_policy.rst @@ -53,6 +53,8 @@ policy warning by setting the policy state to ``OLD``. Alternatively one may fix the project to work with the new behavior and set the policy state to ``NEW``. +.. include:: ../policy/DEPRECATED.txt + Checking Policy Settings ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/command/create_test_sourcelist.rst b/Help/command/create_test_sourcelist.rst index 9addd67..dde6812 100644 --- a/Help/command/create_test_sourcelist.rst +++ b/Help/command/create_test_sourcelist.rst @@ -14,17 +14,17 @@ A test driver is a program that links together many small tests into a single executable. This is useful when building static executables with large libraries to shrink the total required size. The list of source files needed to build the test driver will be in -sourceListName. DriverName is the name of the test driver program. +``sourceListName``. ``driverName`` is the name of the test driver program. The rest of the arguments consist of a list of test source files, can be semicolon separated. Each test source file should have a function in it that is the same name as the file with no extension (foo.cxx -should have int foo(int, char*[]);) DriverName will be able to call -each of the tests by name on the command line. If EXTRA_INCLUDE is +should have int foo(int, char*[]);) ``driverName`` will be able to call +each of the tests by name on the command line. If ``EXTRA_INCLUDE`` is specified, then the next argument is included into the generated file. -If FUNCTION is specified, then the next argument is taken as a +If ``FUNCTION`` is specified, then the next argument is taken as a function name that is passed a pointer to ac and av. This can be used -to add extra command line processing to each test. The cmake variable -CMAKE_TESTDRIVER_BEFORE_TESTMAIN can be set to have code that will be -placed directly before calling the test main function. -CMAKE_TESTDRIVER_AFTER_TESTMAIN can be set to have code that will be -placed directly after the call to the test main function. +to add extra command line processing to each test. The +``CMAKE_TESTDRIVER_BEFORE_TESTMAIN`` cmake variable can be set to +have code that will be placed directly before calling the test main function. +``CMAKE_TESTDRIVER_AFTER_TESTMAIN`` can be set to have code that +will be placed directly after the call to the test main function. diff --git a/Help/command/ctest_run_script.rst b/Help/command/ctest_run_script.rst index 0f35019..5ec543e 100644 --- a/Help/command/ctest_run_script.rst +++ b/Help/command/ctest_run_script.rst @@ -10,6 +10,6 @@ runs a ctest -S script Runs a script or scripts much like if it was run from ctest -S. If no argument is provided then the current script is run using the current -settings of the variables. If NEW_PROCESS is specified then each -script will be run in a separate process.If RETURN_VALUE is specified -the return value of the last script run will be put into var. +settings of the variables. If ``NEW_PROCESS`` is specified then each +script will be run in a separate process.If ``RETURN_VALUE`` is specified +the return value of the last script run will be put into ``var``. diff --git a/Help/command/ctest_start.rst b/Help/command/ctest_start.rst index b5c7b34..63db32f 100644 --- a/Help/command/ctest_start.rst +++ b/Help/command/ctest_start.rst @@ -14,7 +14,7 @@ after the binary directory is initialized. If the 'source' and If the track is specified, the submissions will go to the specified track. If APPEND is used, the existing TAG is used rather than creating a new one based -on the current time stamp. If QUIET is used, CTest will suppress any +on the current time stamp. If ``QUIET`` is used, CTest will suppress any non-error messages that it otherwise would have printed to the console. If the :variable:`CTEST_CHECKOUT_COMMAND` variable diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst index 8cbb9ec..af422b6 100644 --- a/Help/command/ctest_test.rst +++ b/Help/command/ctest_test.rst @@ -41,7 +41,7 @@ The options are: Specify the end of a range of test numbers. ``STRIDE <stride-number>`` - Specify the stride by which to step acorss a range of test numbers. + Specify the stride by which to step across a range of test numbers. ``EXCLUDE <exclude-regex>`` Specify a regular expression matching test names to exclude. diff --git a/Help/command/define_property.rst b/Help/command/define_property.rst index 62bcd1b..873c6ca 100644 --- a/Help/command/define_property.rst +++ b/Help/command/define_property.rst @@ -11,11 +11,11 @@ Define and document custom properties. BRIEF_DOCS <brief-doc> [docs...] FULL_DOCS <full-doc> [docs...]) -Define one property in a scope for use with the set_property and -get_property commands. This is primarily useful to associate +Define one property in a scope for use with the :command:`set_property` and +:command:`get_property` commands. This is primarily useful to associate documentation with property names that may be retrieved with the -get_property command. The first argument determines the kind of scope -in which the property should be used. It must be one of the +:command:`get_property` command. The first argument determines the kind of +scope in which the property should be used. It must be one of the following: :: @@ -28,18 +28,18 @@ following: VARIABLE = documents a CMake language variable CACHED_VARIABLE = documents a CMake cache variable -Note that unlike set_property and get_property no actual scope needs -to be given; only the kind of scope is important. +Note that unlike :command:`set_property` and :command:`get_property` no +actual scope needs to be given; only the kind of scope is important. -The required PROPERTY option is immediately followed by the name of +The required ``PROPERTY`` option is immediately followed by the name of the property being defined. -If the INHERITED option then the get_property command will chain up to -the next higher scope when the requested property is not set in the -scope given to the command. DIRECTORY scope chains to GLOBAL. -TARGET, SOURCE, and TEST chain to DIRECTORY. +If the ``INHERITED`` option then the :command:`get_property` command will +chain up to the next higher scope when the requested property is not set +in the scope given to the command. ``DIRECTORY`` scope chains to +``GLOBAL``. ``TARGET``, ``SOURCE``, and ``TEST`` chain to ``DIRECTORY``. -The BRIEF_DOCS and FULL_DOCS options are followed by strings to be +The ``BRIEF_DOCS`` and ``FULL_DOCS`` options are followed by strings to be associated with the property as its brief and full documentation. -Corresponding options to the get_property command will retrieve the -documentation. +Corresponding options to the :command:`get_property` command will retrieve +the documentation. diff --git a/Help/command/else.rst b/Help/command/else.rst index 5eece95..0e5a198 100644 --- a/Help/command/else.rst +++ b/Help/command/else.rst @@ -7,4 +7,4 @@ Starts the else portion of an if block. else(expression) -See the if command. +See the :command:`if` command. diff --git a/Help/command/elseif.rst b/Help/command/elseif.rst index 96ee0e9..9a8dfed 100644 --- a/Help/command/elseif.rst +++ b/Help/command/elseif.rst @@ -7,4 +7,4 @@ Starts the elseif portion of an if block. elseif(expression) -See the if command. +See the :command:`if` command. diff --git a/Help/command/enable_language.rst b/Help/command/enable_language.rst index d46ff7e..4445561 100644 --- a/Help/command/enable_language.rst +++ b/Help/command/enable_language.rst @@ -18,5 +18,5 @@ targets using the named language directly for compiling sources or indirectly through link dependencies. It is simplest to enable all needed languages in the top-level directory of a project. -The OPTIONAL keyword is a placeholder for future implementation and +The ``OPTIONAL`` keyword is a placeholder for future implementation and does not currently work. diff --git a/Help/command/enable_testing.rst b/Help/command/enable_testing.rst index 41ecd5b..1e3e279 100644 --- a/Help/command/enable_testing.rst +++ b/Help/command/enable_testing.rst @@ -7,7 +7,7 @@ Enable testing for current directory and below. enable_testing() -Enables testing for this directory and below. See also the add_test -command. Note that ctest expects to find a test file in the build -directory root. Therefore, this command should be in the source -directory root. +Enables testing for this directory and below. See also the +:command:`add_test` command. Note that ctest expects to find a test file +in the build directory root. Therefore, this command should be in the +source directory root. diff --git a/Help/command/endforeach.rst b/Help/command/endforeach.rst index f23552d..9af972b 100644 --- a/Help/command/endforeach.rst +++ b/Help/command/endforeach.rst @@ -1,10 +1,10 @@ endforeach ---------- -Ends a list of commands in a FOREACH block. +Ends a list of commands in a foreach block. :: endforeach(expression) -See the FOREACH command. +See the :command:`foreach` command. diff --git a/Help/command/endfunction.rst b/Help/command/endfunction.rst index 63e70ba..6cc196c 100644 --- a/Help/command/endfunction.rst +++ b/Help/command/endfunction.rst @@ -7,4 +7,4 @@ Ends a list of commands in a function block. endfunction(expression) -See the function command. +See the :command:`function` command. diff --git a/Help/command/endif.rst b/Help/command/endif.rst index 4c9955c..a0163bf 100644 --- a/Help/command/endif.rst +++ b/Help/command/endif.rst @@ -7,4 +7,4 @@ Ends a list of commands in an if block. endif(expression) -See the if command. +See the :command:`if` command. diff --git a/Help/command/endmacro.rst b/Help/command/endmacro.rst index 524fc80..47327a7 100644 --- a/Help/command/endmacro.rst +++ b/Help/command/endmacro.rst @@ -7,4 +7,4 @@ Ends a list of commands in a macro block. endmacro(expression) -See the macro command. +See the :command:`macro` command. diff --git a/Help/command/endwhile.rst b/Help/command/endwhile.rst index 11fdc1b..798c20e 100644 --- a/Help/command/endwhile.rst +++ b/Help/command/endwhile.rst @@ -7,4 +7,4 @@ Ends a list of commands in a while block. endwhile(expression) -See the while command. +See the :command:`while` command. diff --git a/Help/command/exec_program.rst b/Help/command/exec_program.rst index aaa0dac..6dfdad3 100644 --- a/Help/command/exec_program.rst +++ b/Help/command/exec_program.rst @@ -1,7 +1,7 @@ exec_program ------------ -Deprecated. Use the execute_process() command instead. +Deprecated. Use the :command:`execute_process` command instead. Run an executable program during the processing of the CMakeList.txt file. @@ -15,10 +15,10 @@ file. The executable is run in the optionally specified directory. The executable can include arguments if it is double quoted, but it is -better to use the optional ARGS argument to specify arguments to the +better to use the optional ``ARGS`` argument to specify arguments to the program. This is because cmake will then be able to escape spaces in -the executable path. An optional argument OUTPUT_VARIABLE specifies a +the executable path. An optional argument ``OUTPUT_VARIABLE`` specifies a variable in which to store the output. To capture the return value of -the execution, provide a RETURN_VALUE. If OUTPUT_VARIABLE is +the execution, provide a ``RETURN_VALUE``. If ``OUTPUT_VARIABLE`` is specified, then no output will go to the stdout/stderr of the console running cmake. diff --git a/Help/command/execute_process.rst b/Help/command/execute_process.rst index c38ec1a..ca44b53 100644 --- a/Help/command/execute_process.rst +++ b/Help/command/execute_process.rst @@ -26,7 +26,7 @@ A single standard error pipe is used for all processes. Options: -COMMAND +``COMMAND`` A child process command line. CMake executes the child process using operating system APIs directly. @@ -36,31 +36,31 @@ COMMAND (Use the ``INPUT_*``, ``OUTPUT_*``, and ``ERROR_*`` options to redirect stdin, stdout, and stderr.) -WORKING_DIRECTORY +``WORKING_DIRECTORY`` The named directory will be set as the current working directory of the child processes. -TIMEOUT +``TIMEOUT`` The child processes will be terminated if they do not finish in the specified number of seconds (fractions are allowed). -RESULT_VARIABLE +``RESULT_VARIABLE`` The variable will be set to contain the result of running the processes. This will be an integer return code from the last child or a string describing an error condition. -OUTPUT_VARIABLE, ERROR_VARIABLE +``OUTPUT_VARIABLE``, ``ERROR_VARIABLE`` The variable named will be set with the contents of the standard output and standard error pipes, respectively. If the same variable is named for both pipes their output will be merged in the order produced. -INPUT_FILE, OUTPUT_FILE, ERROR_FILE +``INPUT_FILE, OUTPUT_FILE``, ``ERROR_FILE`` The file named will be attached to the standard input of the first process, standard output of the last process, or standard error of all processes, respectively. If the same file is named for both output and error then it will be used for both. -OUTPUT_QUIET, ERROR_QUIET +``OUTPUT_QUIET``, ``ERROR_QUIET`` The standard output or standard error results will be quietly ignored. If more than one ``OUTPUT_*`` or ``ERROR_*`` option is given for the diff --git a/Help/command/export.rst b/Help/command/export.rst index d4bab35..4419dc1 100644 --- a/Help/command/export.rst +++ b/Help/command/export.rst @@ -7,20 +7,20 @@ Export targets from the build tree for use by outside projects. export(EXPORT <export-name> [NAMESPACE <namespace>] [FILE <filename>]) -Create a file <filename> that may be included by outside projects to +Create a file ``<filename>`` that may be included by outside projects to import targets from the current project's build tree. This is useful during cross-compiling to build utility executables that can run on the host platform in one project and then import them into another -project being compiled for the target platform. If the NAMESPACE -option is given the <namespace> string will be prepended to all target +project being compiled for the target platform. If the ``NAMESPACE`` +option is given the ``<namespace>`` string will be prepended to all target names written to the file. -Target installations are associated with the export <export-name> +Target installations are associated with the export ``<export-name>`` using the ``EXPORT`` option of the :command:`install(TARGETS)` command. The file created by this command is specific to the build tree and -should never be installed. See the install(EXPORT) command to export -targets from an installation tree. +should never be installed. See the :command:`install(EXPORT)` command to +export targets from an installation tree. The properties set on the generated IMPORTED targets will have the same values as the final values of the input TARGETS. @@ -45,12 +45,12 @@ unspecified. export(PACKAGE <name>) Store the current build directory in the CMake user package registry -for package <name>. The find_package command may consider the -directory while searching for package <name>. This helps dependent +for package ``<name>``. The find_package command may consider the +directory while searching for package ``<name>``. This helps dependent projects find and use a package from the current project's build tree without help from the user. Note that the entry in the package registry that this command creates works only in conjunction with a -package configuration file (<name>Config.cmake) that works with the +package configuration file (``<name>Config.cmake``) that works with the build tree. In some cases, for example for packaging and for system wide installations, it is not desirable to write the user package registry. If the :variable:`CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable diff --git a/Help/command/export_library_dependencies.rst b/Help/command/export_library_dependencies.rst index 73c0b42..2cb437e 100644 --- a/Help/command/export_library_dependencies.rst +++ b/Help/command/export_library_dependencies.rst @@ -7,22 +7,22 @@ Use :command:`install(EXPORT)` or :command:`export` command. This command generates an old-style library dependencies file. Projects requiring CMake 2.6 or later should not use the command. Use -instead the install(EXPORT) command to help export targets from an -installation tree and the export() command to export targets from a +instead the :command:`install(EXPORT)` command to help export targets from an +installation tree and the :command:`export` command to export targets from a build tree. The old-style library dependencies file does not take into account -per-configuration names of libraries or the LINK_INTERFACE_LIBRARIES -target property. +per-configuration names of libraries or the +:prop_tgt:`LINK_INTERFACE_LIBRARIES` target property. :: export_library_dependencies(<file> [APPEND]) -Create a file named <file> that can be included into a CMake listfile +Create a file named ``<file>`` that can be included into a CMake listfile with the INCLUDE command. The file will contain a number of SET commands that will set all the variables needed for library dependency information. This should be the last command in the top level -CMakeLists.txt file of the project. If the APPEND option is +CMakeLists.txt file of the project. If the ``APPEND`` option is specified, the SET commands will be appended to the given file instead of replacing it. diff --git a/Help/command/find_file.rst b/Help/command/find_file.rst index be309a5..bf7a919 100644 --- a/Help/command/find_file.rst +++ b/Help/command/find_file.rst @@ -5,24 +5,27 @@ find_file .. |NAMES| replace:: NAMES name1 [name2 ...] .. |SEARCH_XXX| replace:: full path to a file .. |SEARCH_XXX_DESC| replace:: full path to named file -.. |XXX_SUBDIR| replace:: include +.. |prefix_XXX_SUBDIR| replace:: ``<prefix>/include`` +.. |entry_XXX_SUBDIR| replace:: ``<entry>/include`` .. |CMAKE_PREFIX_PATH_XXX| replace:: - <prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_XXX_PATH| replace:: CMAKE_INCLUDE_PATH -.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_FRAMEWORK_PATH + ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |CMAKE_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH` +.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in INCLUDE, - <prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and - |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, - and the directories in PATH itself. +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``INCLUDE``, + ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, and the + directories in ``PATH`` itself. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: - <prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_INCLUDE_PATH -.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_FRAMEWORK_PATH + ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_SYSTEM_XXX_PATH| replace:: + :variable:`CMAKE_SYSTEM_INCLUDE_PATH` +.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: + :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH` .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: :variable:`CMAKE_FIND_ROOT_PATH_MODE_INCLUDE` diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst index e3dcd2b..5d07574 100644 --- a/Help/command/find_library.rst +++ b/Help/command/find_library.rst @@ -5,33 +5,36 @@ find_library .. |NAMES| replace:: NAMES name1 [name2 ...] [NAMES_PER_DIR] .. |SEARCH_XXX| replace:: library .. |SEARCH_XXX_DESC| replace:: library -.. |XXX_SUBDIR| replace:: lib +.. |prefix_XXX_SUBDIR| replace:: ``<prefix>/lib`` +.. |entry_XXX_SUBDIR| replace:: ``<entry>/lib`` .. |CMAKE_PREFIX_PATH_XXX| replace:: - <prefix>/lib/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_XXX_PATH| replace:: CMAKE_LIBRARY_PATH -.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_FRAMEWORK_PATH + ``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, + and |CMAKE_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_LIBRARY_PATH` +.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in LIB, - <prefix>/lib/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and - |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, - and the directories in PATH itself. +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``LIB``, + ``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, + and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, + and the directories in ``PATH`` itself. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: - <prefix>/lib/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_LIBRARY_PATH -.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_FRAMEWORK_PATH + ``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, + and |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_SYSTEM_XXX_PATH| replace:: + :variable:`CMAKE_SYSTEM_LIBRARY_PATH` +.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: + :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH` .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: :variable:`CMAKE_FIND_ROOT_PATH_MODE_LIBRARY` .. include:: FIND_XXX.txt -When more than one value is given to the NAMES option this command by +When more than one value is given to the ``NAMES`` option this command by default will consider one name at a time and search every directory -for it. The NAMES_PER_DIR option tells this command to consider one +for it. The ``NAMES_PER_DIR`` option tells this command to consider one directory at a time and search for all names in it. Each library name given to the ``NAMES`` option is first considered @@ -40,14 +43,14 @@ prefixes (e.g. ``lib``) and suffixes (e.g. ``.so``). Therefore one may specify library file names such as ``libfoo.a`` directly. This can be used to locate static libraries on UNIX-like systems. -If the library found is a framework, then VAR will be set to the full -path to the framework <fullPath>/A.framework. When a full path to a -framework is used as a library, CMake will use a -framework A, and a --F<fullPath> to link the framework to the target. +If the library found is a framework, then ``<VAR>`` will be set to the full +path to the framework ``<fullPath>/A.framework``. When a full path to a +framework is used as a library, CMake will use a ``-framework A``, and a +``-F<fullPath>`` to link the framework to the target. -If the global property FIND_LIBRARY_USE_LIB64_PATHS is set all search -paths will be tested as normal, with "64/" appended, and with all -matches of "lib/" replaced with "lib64/". This property is +If the :prop_gbl:`FIND_LIBRARY_USE_LIB64_PATHS` global property is set +all search paths will be tested as normal, with ``64/`` appended, and +with all matches of ``lib/`` replaced with ``lib64/``. This property is automatically set for the platforms that are known to need it if at -least one of the languages supported by the PROJECT command is -enabled. +least one of the languages supported by the :command:`project` command +is enabled. diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index a5efba6..58dff9d 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -228,9 +228,9 @@ installation directory. Those marked with (U) are intended for installations on UNIX platforms where the prefix is shared by multiple packages. This is merely a convention, so all (W) and (U) directories are still searched on all platforms. Directories marked with (A) are -intended for installations on Apple platforms. The cmake variables -``CMAKE_FIND_FRAMEWORK`` and ``CMAKE_FIND_APPBUNDLE`` -determine the order of preference as specified below. +intended for installations on Apple platforms. The +:variable:`CMAKE_FIND_FRAMEWORK` and :variable:`CMAKE_FIND_APPBUNDLE` +variables determine the order of preference. The set of installation prefixes is constructed using the following steps. If ``NO_DEFAULT_PATH`` is specified all ``NO_*`` options are @@ -295,7 +295,6 @@ enabled. .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: :variable:`CMAKE_FIND_ROOT_PATH_MODE_PACKAGE` -.. include:: FIND_XXX_MAC.txt .. include:: FIND_XXX_ROOT.txt .. include:: FIND_XXX_ORDER.txt diff --git a/Help/command/find_path.rst b/Help/command/find_path.rst index b5a6e37..4403cb5 100644 --- a/Help/command/find_path.rst +++ b/Help/command/find_path.rst @@ -5,31 +5,34 @@ find_path .. |NAMES| replace:: NAMES name1 [name2 ...] .. |SEARCH_XXX| replace:: file in a directory .. |SEARCH_XXX_DESC| replace:: directory containing the named file -.. |XXX_SUBDIR| replace:: include +.. |prefix_XXX_SUBDIR| replace:: ``<prefix>/include`` +.. |entry_XXX_SUBDIR| replace:: ``<entry>/include`` .. |CMAKE_PREFIX_PATH_XXX| replace:: - <prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_XXX_PATH| replace:: CMAKE_INCLUDE_PATH -.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_FRAMEWORK_PATH + ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |CMAKE_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH` +.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in INCLUDE, - <prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and - |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, - and the directories in PATH itself. +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``INCLUDE``, + ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, and the + directories in ``PATH`` itself. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: - <prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_INCLUDE_PATH -.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_FRAMEWORK_PATH + ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_SYSTEM_XXX_PATH| replace:: + :variable:`CMAKE_SYSTEM_INCLUDE_PATH` +.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: + :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH` .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: :variable:`CMAKE_FIND_ROOT_PATH_MODE_INCLUDE` .. include:: FIND_XXX.txt -When searching for frameworks, if the file is specified as A/b.h, then -the framework search will look for A.framework/Headers/b.h. If that +When searching for frameworks, if the file is specified as ``A/b.h``, then +the framework search will look for ``A.framework/Headers/b.h``. If that is found the path will be set to the path to the framework. CMake -will convert this to the correct -F option to include the file. +will convert this to the correct ``-F`` option to include the file. diff --git a/Help/command/find_program.rst b/Help/command/find_program.rst index c62a8a5..2a5ce9a 100644 --- a/Help/command/find_program.rst +++ b/Help/command/find_program.rst @@ -5,19 +5,22 @@ find_program .. |NAMES| replace:: NAMES name1 [name2 ...] .. |SEARCH_XXX| replace:: program .. |SEARCH_XXX_DESC| replace:: program -.. |XXX_SUBDIR| replace:: [s]bin +.. |prefix_XXX_SUBDIR| replace:: ``<prefix>/[s]bin`` +.. |entry_XXX_SUBDIR| replace:: ``<entry>/[s]bin`` .. |CMAKE_PREFIX_PATH_XXX| replace:: |CMAKE_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_XXX_PATH| replace:: CMAKE_PROGRAM_PATH -.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_APPBUNDLE_PATH +.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_PROGRAM_PATH` +.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_APPBUNDLE_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: PATH +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: ``PATH`` .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_PROGRAM_PATH -.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_APPBUNDLE_PATH +.. |CMAKE_SYSTEM_XXX_PATH| replace:: + :variable:`CMAKE_SYSTEM_PROGRAM_PATH` +.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: + :variable:`CMAKE_SYSTEM_APPBUNDLE_PATH` .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: :variable:`CMAKE_FIND_ROOT_PATH_MODE_PROGRAM` diff --git a/Help/command/fltk_wrap_ui.rst b/Help/command/fltk_wrap_ui.rst index 448ae64..041e5a7 100644 --- a/Help/command/fltk_wrap_ui.rst +++ b/Help/command/fltk_wrap_ui.rst @@ -10,5 +10,5 @@ Create FLTK user interfaces Wrappers. Produce .h and .cxx files for all the .fl and .fld files listed. The resulting .h and .cxx files will be added to a variable named -resultingLibraryName_FLTK_UI_SRCS which should be added to your +``resultingLibraryName_FLTK_UI_SRCS`` which should be added to your library. diff --git a/Help/command/foreach.rst b/Help/command/foreach.rst index 348ebd8..c0f3679 100644 --- a/Help/command/foreach.rst +++ b/Help/command/foreach.rst @@ -15,7 +15,7 @@ All commands between foreach and the matching endforeach are recorded without being invoked. Once the endforeach is evaluated, the recorded list of commands is invoked once for each argument listed in the original foreach command. Before each iteration of the loop -"${loop_var}" will be set as a variable with the current value in the +``${loop_var}`` will be set as a variable with the current value in the list. :: @@ -40,8 +40,8 @@ three types of this iteration: foreach(loop_var IN [LISTS [list1 [...]]] [ITEMS [item1 [...]]]) -Iterates over a precise list of items. The LISTS option names +Iterates over a precise list of items. The ``LISTS`` option names list-valued variables to be traversed, including empty elements (an empty string is a zero-length list). (Note macro -arguments are not variables.) The ITEMS option ends argument +arguments are not variables.) The ``ITEMS`` option ends argument parsing and includes all arguments following it in the iteration. diff --git a/Help/command/get_cmake_property.rst b/Help/command/get_cmake_property.rst index bcfc5e8..3a6fb41 100644 --- a/Help/command/get_cmake_property.rst +++ b/Help/command/get_cmake_property.rst @@ -8,8 +8,8 @@ Get a property of the CMake instance. get_cmake_property(VAR property) Get a property from the CMake instance. The value of the property is -stored in the variable VAR. If the property is not found, VAR will be -set to "NOTFOUND". Some supported properties include: VARIABLES, -CACHE_VARIABLES, COMMANDS, MACROS, and COMPONENTS. +stored in the variable ``VAR``. If the property is not found, ``VAR`` +will be set to "NOTFOUND". See the :manual:`cmake-properties(7)` manual +for available properties. -See also the more general get_property() command. +See also the more general :command:`get_property` command. diff --git a/Help/command/get_directory_property.rst b/Help/command/get_directory_property.rst index f2a0a80..e50abe0 100644 --- a/Help/command/get_directory_property.rst +++ b/Help/command/get_directory_property.rst @@ -1,14 +1,14 @@ get_directory_property ---------------------- -Get a property of DIRECTORY scope. +Get a property of ``DIRECTORY`` scope. :: get_directory_property(<variable> [DIRECTORY <dir>] <prop-name>) Store a property of directory scope in the named variable. If the -property is not defined the empty-string is returned. The DIRECTORY +property is not defined the empty-string is returned. The ``DIRECTORY`` argument specifies another directory from which to retrieve the property value. The specified directory must have already been traversed by CMake. @@ -21,4 +21,4 @@ traversed by CMake. Get a variable definition from a directory. This form is useful to get a variable definition from another directory. -See also the more general get_property() command. +See also the more general :command:`get_property` command. diff --git a/Help/command/get_filename_component.rst b/Help/command/get_filename_component.rst index 5eec792..60488da 100644 --- a/Help/command/get_filename_component.rst +++ b/Help/command/get_filename_component.rst @@ -7,7 +7,7 @@ Get a specific component of a full filename. get_filename_component(<VAR> <FileName> <COMP> [CACHE]) -Set <VAR> to a component of <FileName>, where <COMP> is one of: +Set ``<VAR>`` to a component of ``<FileName>``, where ``<COMP>`` is one of: :: @@ -21,7 +21,7 @@ Set <VAR> to a component of <FileName>, where <COMP> is one of: Paths are returned with forward slashes and have no trailing slahes. The longest file extension is always considered. If the optional -CACHE argument is specified, the result variable is added to the +``CACHE`` argument is specified, the result variable is added to the cache. :: @@ -30,8 +30,8 @@ cache. PROGRAM [PROGRAM_ARGS <ARG_VAR>] [CACHE]) -The program in FileName will be found in the system search path or -left as a full path. If PROGRAM_ARGS is present with PROGRAM, then -any command-line arguments present in the FileName string are split -from the program name and stored in <ARG_VAR>. This is used to +The program in ``FileName`` will be found in the system search path or +left as a full path. If ``PROGRAM_ARGS`` is present with ``PROGRAM``, then +any command-line arguments present in the ``FileName`` string are split +from the program name and stored in ``<ARG_VAR>``. This is used to separate a program name from its arguments in a command line string. diff --git a/Help/command/get_source_file_property.rst b/Help/command/get_source_file_property.rst index 80c512b..3e975c2 100644 --- a/Help/command/get_source_file_property.rst +++ b/Help/command/get_source_file_property.rst @@ -8,9 +8,9 @@ Get a property for a source file. get_source_file_property(VAR file property) Get a property from a source file. The value of the property is -stored in the variable VAR. If the property is not found, VAR will be -set to "NOTFOUND". Use set_source_files_properties to set property -values. Source file properties usually control how the file is built. -One property that is always there is LOCATION +stored in the variable ``VAR``. If the property is not found, ``VAR`` +will be set to "NOTFOUND". Use :command:`set_source_files_properties` +to set property values. Source file properties usually control how the +file is built. One property that is always there is :prop_sf:`LOCATION` -See also the more general get_property() command. +See also the more general :command:`get_property` command. diff --git a/Help/command/get_target_property.rst b/Help/command/get_target_property.rst index 4017d31..7798252 100644 --- a/Help/command/get_target_property.rst +++ b/Help/command/get_target_property.rst @@ -8,11 +8,11 @@ Get a property from a target. get_target_property(VAR target property) Get a property from a target. The value of the property is stored in -the variable VAR. If the property is not found, VAR will be set to -"NOTFOUND". Use set_target_properties to set property values. +the variable ``VAR``. If the property is not found, ``VAR`` will be set to +"NOTFOUND". Use :command:`set_target_properties` to set property values. Properties are usually used to control how a target is built, but some query the target instead. This command can get properties for any target so far created. The targets do not need to be in the current CMakeLists.txt file. -See also the more general get_property() command. +See also the more general :command:`get_property` command. diff --git a/Help/command/get_test_property.rst b/Help/command/get_test_property.rst index 391a32e..e359f4b 100644 --- a/Help/command/get_test_property.rst +++ b/Help/command/get_test_property.rst @@ -8,8 +8,8 @@ Get a property of the test. get_test_property(test property VAR) Get a property from the test. The value of the property is stored in -the variable VAR. If the test or property is not found, VAR will be -set to "NOTFOUND". For a list of standard properties you can type cmake ---help-property-list. +the variable ``VAR``. If the test or property is not found, ``VAR`` will +be set to "NOTFOUND". For a list of standard properties you can type +``cmake --help-property-list``. -See also the more general get_property() command. +See also the more general :command:`get_property` command. diff --git a/Help/command/include.rst b/Help/command/include.rst index a9074c1..c391561 100644 --- a/Help/command/include.rst +++ b/Help/command/include.rst @@ -9,17 +9,17 @@ Load and run CMake code from a file or module. [NO_POLICY_SCOPE]) Load and run CMake code from the file given. Variable reads and -writes access the scope of the caller (dynamic scoping). If OPTIONAL +writes access the scope of the caller (dynamic scoping). If ``OPTIONAL`` is present, then no error is raised if the file does not exist. If -RESULT_VARIABLE is given the variable will be set to the full filename +``RESULT_VARIABLE`` is given the variable will be set to the full filename which has been included or NOTFOUND if it failed. If a module is specified instead of a file, the file with name -<modulename>.cmake is searched first in CMAKE_MODULE_PATH, then in the -CMake module directory. There is one exception to this: if the file -which calls include() is located itself in the CMake module directory, -then first the CMake module directory is searched and -CMAKE_MODULE_PATH afterwards. See also policy CMP0017. +<modulename>.cmake is searched first in :variable:`CMAKE_MODULE_PATH`, +then in the CMake module directory. There is one exception to this: if +the file which calls ``include()`` is located itself in the CMake module +directory, then first the CMake module directory is searched and +:variable:`CMAKE_MODULE_PATH` afterwards. See also policy :policy:`CMP0017`. -See the cmake_policy() command documentation for discussion of the -NO_POLICY_SCOPE option. +See the :command:`cmake_policy` command documentation for discussion of the +``NO_POLICY_SCOPE`` option. diff --git a/Help/command/include_external_msproject.rst b/Help/command/include_external_msproject.rst index ba9a393..595762d 100644 --- a/Help/command/include_external_msproject.rst +++ b/Help/command/include_external_msproject.rst @@ -13,10 +13,10 @@ Include an external Microsoft project file in a workspace. Includes an external Microsoft project in the generated workspace file. Currently does nothing on UNIX. This will create a target -named [projectname]. This can be used in the add_dependencies command -to make things depend on the external project. +named [projectname]. This can be used in the :command:`add_dependencies` +command to make things depend on the external project. -TYPE, GUID and PLATFORM are optional parameters that allow one to +``TYPE``, ``GUID`` and ``PLATFORM`` are optional parameters that allow one to specify the type of project, id (GUID) of the project and the name of the target platform. This is useful for projects requiring values other than the default (e.g. WIX projects). These options are not diff --git a/Help/command/include_regular_expression.rst b/Help/command/include_regular_expression.rst index dd887df..ab5a563 100644 --- a/Help/command/include_regular_expression.rst +++ b/Help/command/include_regular_expression.rst @@ -8,8 +8,8 @@ Set the regular expression used for dependency checking. include_regular_expression(regex_match [regex_complain]) Set the regular expressions used in dependency checking. Only files -matching regex_match will be traced as dependencies. Only files -matching regex_complain will generate warnings if they cannot be found +matching ``regex_match`` will be traced as dependencies. Only files +matching ``regex_complain`` will generate warnings if they cannot be found (standard header paths are not searched). The defaults are: :: diff --git a/Help/command/install_files.rst b/Help/command/install_files.rst index 7b6bd81..1850be6 100644 --- a/Help/command/install_files.rst +++ b/Help/command/install_files.rst @@ -1,13 +1,13 @@ install_files ------------- -Deprecated. Use the install(FILES ) command instead. +Deprecated. Use the :command:`install(FILES)` command instead. -This command has been superceded by the install command. It is -provided for compatibility with older CMake code. The FILES form is -directly replaced by the FILES form of the install command. The -regexp form can be expressed more clearly using the GLOB form of the -file command. +This command has been superceded by the :command:`install` command. It is +provided for compatibility with older CMake code. The ``FILES`` form is +directly replaced by the ``FILES`` form of the :command:`install` +command. The regexp form can be expressed more clearly using the ``GLOB`` +form of the :command:`file` command. :: @@ -32,8 +32,8 @@ expression will be installed. install_files(<dir> FILES file file ...) -Any files listed after the FILES keyword will be installed explicitly +Any files listed after the ``FILES`` keyword will be installed explicitly from the names given. Full paths are allowed in this form. -The directory <dir> is relative to the installation prefix, which is -stored in the variable CMAKE_INSTALL_PREFIX. +The directory ``<dir>`` is relative to the installation prefix, which is +stored in the variable :variable:`CMAKE_INSTALL_PREFIX`. diff --git a/Help/command/install_programs.rst b/Help/command/install_programs.rst index 26789d8..79aa486 100644 --- a/Help/command/install_programs.rst +++ b/Help/command/install_programs.rst @@ -1,13 +1,13 @@ install_programs ---------------- -Deprecated. Use the install(PROGRAMS ) command instead. +Deprecated. Use the :command:`install(PROGRAMS)` command instead. -This command has been superceded by the install command. It is -provided for compatibility with older CMake code. The FILES form is -directly replaced by the PROGRAMS form of the INSTALL command. The -regexp form can be expressed more clearly using the GLOB form of the -FILE command. +This command has been superceded by the :command:`install` command. It is +provided for compatibility with older CMake code. The ``FILES`` form is +directly replaced by the ``PROGRAMS`` form of the :command:`install` +command. The regexp form can be expressed more clearly using the ``GLOB`` +form of the :command:`file` command. :: @@ -15,7 +15,7 @@ FILE command. install_programs(<dir> FILES file1 [file2 ...]) Create rules to install the listed programs into the given directory. -Use the FILES argument to guarantee that the file list version of the +Use the ``FILES`` argument to guarantee that the file list version of the command will be used even when there is only one argument. :: @@ -26,8 +26,9 @@ In the second form any program in the current source directory that matches the regular expression will be installed. This command is intended to install programs that are not built by -cmake, such as shell scripts. See the TARGETS form of the INSTALL -command to create installation rules for targets built by cmake. +cmake, such as shell scripts. See the ``TARGETS`` form of the +:command:`install` command to create installation rules for targets built +by cmake. -The directory <dir> is relative to the installation prefix, which is -stored in the variable CMAKE_INSTALL_PREFIX. +The directory ``<dir>`` is relative to the installation prefix, which is +stored in the variable :variable:`CMAKE_INSTALL_PREFIX`. diff --git a/Help/command/install_targets.rst b/Help/command/install_targets.rst index caa933f..49ca696 100644 --- a/Help/command/install_targets.rst +++ b/Help/command/install_targets.rst @@ -1,9 +1,9 @@ install_targets --------------- -Deprecated. Use the install(TARGETS ) command instead. +Deprecated. Use the :command:`install(TARGETS)` command instead. -This command has been superceded by the install command. It is +This command has been superceded by the :command:`install` command. It is provided for compatibility with older CMake code. :: @@ -11,7 +11,7 @@ provided for compatibility with older CMake code. install_targets(<dir> [RUNTIME_DIRECTORY dir] target target) Create rules to install the listed targets into the given directory. -The directory <dir> is relative to the installation prefix, which is -stored in the variable CMAKE_INSTALL_PREFIX. If RUNTIME_DIRECTORY is -specified, then on systems with special runtime files (Windows DLL), -the files will be copied to that directory. +The directory ``<dir>`` is relative to the installation prefix, which is +stored in the variable :variable:`CMAKE_INSTALL_PREFIX`. If +``RUNTIME_DIRECTORY`` is specified, then on systems with special runtime +files (Windows DLL), the files will be copied to that directory. diff --git a/Help/command/link_directories.rst b/Help/command/link_directories.rst index bdc94cd..5c64bc6 100644 --- a/Help/command/link_directories.rst +++ b/Help/command/link_directories.rst @@ -10,10 +10,10 @@ Specify directories in which the linker will look for libraries. Specify the paths in which the linker should search for libraries. The command will apply only to targets created after it is called. Relative paths given to this command are interpreted as relative to -the current source directory, see CMP0015. +the current source directory, see :policy:`CMP0015`. Note that this command is rarely necessary. Library locations -returned by find_package() and find_library() are absolute paths. -Pass these absolute library file paths directly to the -target_link_libraries() command. CMake will ensure the linker finds +returned by :command:`find_package` and :command:`find_library` are +absolute paths. Pass these absolute library file paths directly to the +:command:`target_link_libraries` command. CMake will ensure the linker finds them. diff --git a/Help/command/list.rst b/Help/command/list.rst index aeb1e94..a7a05c7 100644 --- a/Help/command/list.rst +++ b/Help/command/list.rst @@ -17,45 +17,45 @@ List operations. list(REVERSE <list>) list(SORT <list>) -LENGTH will return a given list's length. +``LENGTH`` will return a given list's length. -GET will return list of elements specified by indices from the list. +``GET`` will return list of elements specified by indices from the list. -APPEND will append elements to the list. +``APPEND`` will append elements to the list. -FIND will return the index of the element specified in the list or -1 +``FIND`` will return the index of the element specified in the list or -1 if it wasn't found. -INSERT will insert elements to the list to the specified location. +``INSERT`` will insert elements to the list to the specified location. -REMOVE_AT and REMOVE_ITEM will remove items from the list. The -difference is that REMOVE_ITEM will remove the given items, while -REMOVE_AT will remove the items at the given indices. +``REMOVE_AT`` and ``REMOVE_ITEM`` will remove items from the list. The +difference is that ``REMOVE_ITEM`` will remove the given items, while +``REMOVE_AT`` will remove the items at the given indices. -REMOVE_DUPLICATES will remove duplicated items in the list. +``REMOVE_DUPLICATES`` will remove duplicated items in the list. -REVERSE reverses the contents of the list in-place. +``REVERSE`` reverses the contents of the list in-place. -SORT sorts the list in-place alphabetically. +``SORT`` sorts the list in-place alphabetically. -The list subcommands APPEND, INSERT, REMOVE_AT, REMOVE_ITEM, -REMOVE_DUPLICATES, REVERSE and SORT may create new values for the list -within the current CMake variable scope. Similar to the SET command, -the LIST command creates new variable values in the current scope, -even if the list itself is actually defined in a parent scope. To -propagate the results of these operations upwards, use SET with -PARENT_SCOPE, SET with CACHE INTERNAL, or some other means of value -propagation. +The list subcommands ``APPEND``, ``INSERT``, ``REMOVE_AT``, ``REMOVE_ITEM``, +``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create new values for +the list within the current CMake variable scope. Similar to the +:command:`set` command, the LIST command creates new variable values in the +current scope, even if the list itself is actually defined in a parent +scope. To propagate the results of these operations upwards, use +:command:`set` with ``PARENT_SCOPE``, :command:`set` with +``CACHE INTERNAL``, or some other means of value propagation. -NOTES: A list in cmake is a ; separated group of strings. To create a -list the set command can be used. For example, set(var a b c d e) -creates a list with a;b;c;d;e, and set(var "a b c d e") creates a +NOTES: A list in cmake is a ``;`` separated group of strings. To create a +list the set command can be used. For example, ``set(var a b c d e)`` +creates a list with ``a;b;c;d;e``, and ``set(var "a b c d e")`` creates a string or a list with one item in it. (Note macro arguments are not variables, and therefore cannot be used in LIST commands.) -When specifying index values, if <element index> is 0 or greater, it +When specifying index values, if ``<element index>`` is 0 or greater, it is indexed from the beginning of the list, with 0 representing the -first list element. If <element index> is -1 or lesser, it is indexed +first list element. If ``<element index>`` is -1 or lesser, it is indexed from the end of the list, with -1 representing the last list element. Be careful when counting with negative indices: they do not start from 0. -0 is equivalent to 0, the first list element. diff --git a/Help/command/load_cache.rst b/Help/command/load_cache.rst index b7484cb..f113447 100644 --- a/Help/command/load_cache.rst +++ b/Help/command/load_cache.rst @@ -19,9 +19,9 @@ does not create entries in the local project's cache. Load in the values from another cache and store them in the local project's cache as internal entries. This is useful for a project -that depends on another project built in a different tree. EXCLUDE +that depends on another project built in a different tree. ``EXCLUDE`` option can be used to provide a list of entries to be excluded. -INCLUDE_INTERNALS can be used to provide a list of internal entries to +``INCLUDE_INTERNALS`` can be used to provide a list of internal entries to be included. Normally, no internal entries are brought in. Use of this form of the command is strongly discouraged, but it is provided for backward compatibility. diff --git a/Help/command/load_command.rst b/Help/command/load_command.rst index fc316d4..a1576e8 100644 --- a/Help/command/load_command.rst +++ b/Help/command/load_command.rst @@ -11,9 +11,9 @@ Load a command into a running CMake. The given locations are searched for a library whose name is cmCOMMAND_NAME. If found, it is loaded as a module and the command is -added to the set of available CMake commands. Usually, TRY_COMPILE is -used before this command to compile the module. If the command is -successfully loaded a variable named +added to the set of available CMake commands. Usually, +:command:`try_compile` is used before this command to compile the +module. If the command is successfully loaded a variable named :: diff --git a/Help/command/make_directory.rst b/Help/command/make_directory.rst index 44dbe97..27ecf51 100644 --- a/Help/command/make_directory.rst +++ b/Help/command/make_directory.rst @@ -1,7 +1,7 @@ make_directory -------------- -Deprecated. Use the file(MAKE_DIRECTORY ) command instead. +Deprecated. Use the :command:`file(MAKE_DIRECTORY)` command instead. :: diff --git a/Help/command/mark_as_advanced.rst b/Help/command/mark_as_advanced.rst index 30b1289..c3f94fc 100644 --- a/Help/command/mark_as_advanced.rst +++ b/Help/command/mark_as_advanced.rst @@ -9,10 +9,10 @@ Mark cmake cached variables as advanced. Mark the named cached variables as advanced. An advanced variable will not be displayed in any of the cmake GUIs unless the show -advanced option is on. If CLEAR is the first argument advanced -variables are changed back to unadvanced. If FORCE is the first -argument, then the variable is made advanced. If neither FORCE nor -CLEAR is specified, new values will be marked as advanced, but if the +advanced option is on. If ``CLEAR`` is the first argument advanced +variables are changed back to unadvanced. If ``FORCE`` is the first +argument, then the variable is made advanced. If neither ``FORCE`` nor +``CLEAR`` is specified, new values will be marked as advanced, but if the variable already has an advanced/non-advanced state, it will not be changed. diff --git a/Help/command/math.rst b/Help/command/math.rst index 38fde1d..d4deb16 100644 --- a/Help/command/math.rst +++ b/Help/command/math.rst @@ -7,7 +7,7 @@ Mathematical expressions. math(EXPR <output variable> <math expression>) -EXPR evaluates mathematical expression and returns result in the +``EXPR`` evaluates mathematical expression and returns result in the output variable. Example mathematical expression is '5 * ( 10 + 13 )'. Supported operators are + - * / % | & ^ ~ << >> * / %. They have the same meaning as they do in C code. diff --git a/Help/command/message.rst b/Help/command/message.rst index a20325a..04c62fd 100644 --- a/Help/command/message.rst +++ b/Help/command/message.rst @@ -7,7 +7,7 @@ Display a message to the user. message([<mode>] "message to display" ...) -The optional <mode> keyword determines the type of message: +The optional ``<mode>`` keyword determines the type of message: :: diff --git a/Help/command/option.rst b/Help/command/option.rst index 244ed07..91cd0a7 100644 --- a/Help/command/option.rst +++ b/Help/command/option.rst @@ -8,8 +8,8 @@ Provides an option that the user can optionally select. option(<option_variable> "help string describing option" [initial value]) -Provide an option for the user to select as ON or OFF. If no initial -value is provided, OFF is used. +Provide an option for the user to select as ``ON`` or ``OFF``. If no +initial value is provided, ``OFF`` is used. If you have options that depend on the values of other options, see -the module help for CMakeDependentOption. +the module help for :module:`CMakeDependentOption`. diff --git a/Help/command/qt_wrap_cpp.rst b/Help/command/qt_wrap_cpp.rst index 81bbc06..3843bf5 100644 --- a/Help/command/qt_wrap_cpp.rst +++ b/Help/command/qt_wrap_cpp.rst @@ -9,4 +9,4 @@ Create Qt Wrappers. SourceLists ...) Produce moc files for all the .h files listed in the SourceLists. The -moc files will be added to the library using the DestName source list. +moc files will be added to the library using the ``DestName`` source list. diff --git a/Help/command/qt_wrap_ui.rst b/Help/command/qt_wrap_ui.rst index 4e033a8..f731ed9 100644 --- a/Help/command/qt_wrap_ui.rst +++ b/Help/command/qt_wrap_ui.rst @@ -9,6 +9,6 @@ Create Qt user interfaces Wrappers. SourcesDestName SourceLists ...) Produce .h and .cxx files for all the .ui files listed in the -SourceLists. The .h files will be added to the library using the -HeadersDestNamesource list. The .cxx files will be added to the -library using the SourcesDestNamesource list. +``SourceLists``. The .h files will be added to the library using the +``HeadersDestNamesource`` list. The .cxx files will be added to the +library using the ``SourcesDestNamesource`` list. diff --git a/Help/command/remove.rst b/Help/command/remove.rst index ddf0e9a..4628277 100644 --- a/Help/command/remove.rst +++ b/Help/command/remove.rst @@ -1,12 +1,12 @@ remove ------ -Deprecated. Use the list(REMOVE_ITEM ) command instead. +Deprecated. Use the :command:`list(REMOVE_ITEM)` command instead. :: remove(VAR VALUE VALUE ...) -Removes VALUE from the variable VAR. This is typically used to remove -entries from a vector (e.g. semicolon separated list). VALUE is -expanded. +Removes ``VALUE`` from the variable ``VAR``. This is typically used to +remove entries from a vector (e.g. semicolon separated list). ``VALUE`` +is expanded. diff --git a/Help/command/remove_definitions.rst b/Help/command/remove_definitions.rst index 566da6e..ea18918 100644 --- a/Help/command/remove_definitions.rst +++ b/Help/command/remove_definitions.rst @@ -1,11 +1,11 @@ remove_definitions ------------------ -Removes -D define flags added by add_definitions. +Removes -D define flags added by :command:`add_definitions`. :: remove_definitions(-DFOO -DBAR ...) -Removes flags (added by add_definitions) from the compiler command -line for sources in the current directory and below. +Removes flags (added by :command:`add_definitions`) from the compiler +command line for sources in the current directory and below. diff --git a/Help/command/return.rst b/Help/command/return.rst index 899470c..e49fb3c 100644 --- a/Help/command/return.rst +++ b/Help/command/return.rst @@ -8,11 +8,11 @@ Return from a file, directory or function. return() Returns from a file, directory or function. When this command is -encountered in an included file (via include() or find_package()), it -causes processing of the current file to stop and control is returned -to the including file. If it is encountered in a file which is not -included by another file, e.g. a CMakeLists.txt, control is returned -to the parent directory if there is one. If return is called in a -function, control is returned to the caller of the function. Note -that a macro is not a function and does not handle return like a +encountered in an included file (via :command:`include` or +:command:`find_package`), it causes processing of the current file to stop +and control is returned to the including file. If it is encountered in a +file which is not included by another file, e.g. a ``CMakeLists.txt``, +control is returned to the parent directory if there is one. If return is +called in a function, control is returned to the caller of the function. +Note that a macro is not a function and does not handle return like a function does. diff --git a/Help/command/separate_arguments.rst b/Help/command/separate_arguments.rst index a876595..0e3e5a5 100644 --- a/Help/command/separate_arguments.rst +++ b/Help/command/separate_arguments.rst @@ -8,15 +8,15 @@ Parse space-separated arguments into a semicolon-separated list. separate_arguments(<var> <UNIX|WINDOWS>_COMMAND "<args>") Parses a unix- or windows-style command-line string "<args>" and -stores a semicolon-separated list of the arguments in <var>. The +stores a semicolon-separated list of the arguments in ``<var>``. The entire command line must be given in one "<args>" argument. -The UNIX_COMMAND mode separates arguments by unquoted whitespace. It +The ``UNIX_COMMAND`` mode separates arguments by unquoted whitespace. It recognizes both single-quote and double-quote pairs. A backslash escapes the next literal character (\" is "); there are no special escapes (\n is just n). -The WINDOWS_COMMAND mode parses a windows command-line using the same +The ``WINDOWS_COMMAND`` mode parses a windows command-line using the same syntax the runtime library uses to construct argv at startup. It separates arguments by whitespace that is not double-quoted. Backslashes are literal unless they precede double-quotes. See the @@ -26,6 +26,6 @@ MSDN article "Parsing C Command-Line Arguments" for details. separate_arguments(VARIABLE) -Convert the value of VARIABLE to a semi-colon separated list. All +Convert the value of ``VARIABLE`` to a semi-colon separated list. All spaces are replaced with ';'. This helps with generating command lines. diff --git a/Help/command/set_target_properties.rst b/Help/command/set_target_properties.rst index f65ee24..2accfb0 100644 --- a/Help/command/set_target_properties.rst +++ b/Help/command/set_target_properties.rst @@ -12,93 +12,98 @@ Targets can have properties that affect how they are built. Set properties on a target. The syntax for the command is to list all the files you want to change, and then provide the values you want to set next. You can use any prop value pair you want and extract it -later with the GET_TARGET_PROPERTY command. +later with the :command:`get_target_property` command. Properties that affect the name of a target's output file are as -follows. The PREFIX and SUFFIX properties override the default target -name prefix (such as "lib") and suffix (such as ".so"). IMPORT_PREFIX -and IMPORT_SUFFIX are the equivalent properties for the import library -corresponding to a DLL (for SHARED library targets). OUTPUT_NAME sets -the real name of a target when it is built and can be used to help -create two targets of the same name even though CMake requires unique -logical target names. There is also a <CONFIG>_OUTPUT_NAME that can -set the output name on a per-configuration basis. <CONFIG>_POSTFIX -sets a postfix for the real name of the target when it is built under -the configuration named by <CONFIG> (in upper-case, such as -"DEBUG_POSTFIX"). The value of this property is initialized when the -target is created to the value of the variable CMAKE_<CONFIG>_POSTFIX +follows. The :prop_tgt:`PREFIX` and :prop_tgt:`SUFFIX` properties +override the default target name prefix (such as "lib") and suffix +(such as ".so"). :prop_tgt:`IMPORT_PREFIX` and +:prop_tgt:`IMPORT_SUFFIX` are the equivalent properties for the import +library corresponding to a DLL (for SHARED library targets). +:prop_tgt:`OUTPUT_NAME` sets the real name of a target when it is built +and can be used to help create two targets of the same name even though +CMake requires unique logical target names. There is also a +:prop_tgt:`<CONFIG>_OUTPUT_NAME` that can set the output name on a +per-configuration basis. :prop_tgt:`<CONFIG>_POSTFIX` sets a postfix for +the real name of the target when it is built under the configuration named +by ``<CONFIG>`` (in upper-case, such as "DEBUG_POSTFIX"). The value of this +property is initialized when the target is created to the value of the +variable :variable:`CMAKE_<CONFIG>_POSTFIX` (except for executable targets because earlier CMake versions which did not use this variable for executables). -The LINK_FLAGS property can be used to add extra flags to the link -step of a target. LINK_FLAGS_<CONFIG> will add to the configuration -<CONFIG>, for example, DEBUG, RELEASE, MINSIZEREL, RELWITHDEBINFO. -DEFINE_SYMBOL sets the name of the preprocessor symbol defined when -compiling sources in a shared library. If not set here then it is set -to target_EXPORTS by default (with some substitutions if the target is -not a valid C identifier). This is useful for headers to know whether -they are being included from inside their library or outside to -properly setup dllexport/dllimport decorations. The COMPILE_FLAGS -property sets additional compiler flags used to build sources within -the target. It may also be used to pass additional preprocessor -definitions. +The :prop_tgt:`LINK_FLAGS` property can be used to add extra flags to the +link step of a target. :prop_tgt:`LINK_FLAGS_<CONFIG>` will add to the +configuration ``<CONFIG>``, for example, ``DEBUG``, ``RELEASE``, +``MINSIZEREL``,``RELWITHDEBINFO``. :prop_tgt:`DEFINE_SYMBOL` sets the name +of the preprocessor symbol defined when compiling sources in a shared +library. If not set here then it is set to target_EXPORTS by default +(with some substitutions if the target is not a valid C identifier). This +is useful for headers to know whether they are being included from inside +their library or outside to properly setup dllexport/dllimport +decorations. The :prop_tgt:`COMPILE_FLAGS` property sets additional +compiler flags used to build sources within the target. It may also be +used to pass additional preprocessor definitions. -The LINKER_LANGUAGE property is used to change the tool used to link -an executable or shared library. The default is set the language to -match the files in the library. CXX and C are common values for this +The :prop_tgt:`LINKER_LANGUAGE` property is used to change the tool used +to link an executable or shared library. The default is set the language to +match the files in the library. ``CXX`` and ``C`` are common values for this property. -For shared libraries VERSION and SOVERSION can be used to specify the -build version and API version respectively. When building or -installing appropriate symlinks are created if the platform supports -symlinks and the linker supports so-names. If only one of both is +For shared libraries :prop_tgt:`VERSION` and :prop_tgt:`SOVERSION` can be +used to specify the build version and API version respectively. When +building or installing appropriate symlinks are created if the platform +supports symlinks and the linker supports so-names. If only one of both is specified the missing is assumed to have the same version number. For -executables VERSION can be used to specify the build version. When -building or installing appropriate symlinks are created if the -platform supports symlinks. For shared libraries and executables on -Windows the VERSION attribute is parsed to extract a "major.minor" -version number. These numbers are used as the image version of the -binary. +executables :prop_tgt:`VERSION` can be used to specify the build +version. When building or installing appropriate symlinks are created if +the platform supports symlinks. For shared libraries and executables on +Windows the :prop_tgt:`VERSION` attribute is parsed to extract a +"major.minor" version number. These numbers are used as the image +version of the binary. -There are a few properties used to specify RPATH rules. INSTALL_RPATH -is a semicolon-separated list specifying the rpath to use in installed -targets (for platforms that support it). INSTALL_RPATH_USE_LINK_PATH -is a boolean that if set to true will append directories in the linker -search path and outside the project to the INSTALL_RPATH. -SKIP_BUILD_RPATH is a boolean specifying whether to skip automatic -generation of an rpath allowing the target to run from the build tree. -BUILD_WITH_INSTALL_RPATH is a boolean specifying whether to link the -target in the build tree with the INSTALL_RPATH. This takes -precedence over SKIP_BUILD_RPATH and avoids the need for relinking -before installation. INSTALL_NAME_DIR is a string specifying the +There are a few properties used to specify RPATH rules. +:prop_tgt:`INSTALL_RPATH` is a semicolon-separated list specifying the +rpath to use in installed targets (for platforms that support it). +:prop_tgt:`INSTALL_RPATH_USE_LINK_PATH` is a boolean that if set to true +will append directories in the linker search path and outside the project +to the :prop_tgt:`INSTALL_RPATH`. :prop_tgt:`SKIP_BUILD_RPATH` is a boolean +specifying whether to skip automatic generation of an rpath allowing the +target to run from the build tree. :prop_tgt:`BUILD_WITH_INSTALL_RPATH` is +a boolean specifying whether to link the target in the build tree with the +:prop_tgt:`INSTALL_RPATH`. This takes precedence over +:prop_tgt:`SKIP_BUILD_RPATH` and avoids the need for relinking before +installation. :prop_tgt:`INSTALL_NAME_DIR` is a string specifying the directory portion of the "install_name" field of shared libraries on Mac OSX to use in the installed targets. When the target is created -the values of the variables CMAKE_INSTALL_RPATH, -CMAKE_INSTALL_RPATH_USE_LINK_PATH, CMAKE_SKIP_BUILD_RPATH, -CMAKE_BUILD_WITH_INSTALL_RPATH, and CMAKE_INSTALL_NAME_DIR are used to -initialize these properties. +the values of the variables :variable:`CMAKE_INSTALL_RPATH`, +:variable:`CMAKE_INSTALL_RPATH_USE_LINK_PATH`, +:variable:`CMAKE_SKIP_BUILD_RPATH`, +:variable:`CMAKE_BUILD_WITH_INSTALL_RPATH`, and +:variable:`CMAKE_INSTALL_NAME_DIR` are used to initialize these properties. -PROJECT_LABEL can be used to change the name of the target in an IDE -like visual studio. VS_KEYWORD can be set to change the visual studio -keyword, for example Qt integration works better if this is set to -Qt4VSv1.0. +:prop_tgt:`PROJECT_LABEL` can be used to change the name of the target in +an IDE like visual studio. :prop_tgt:`VS_KEYWORD` can be set to change +the visual studio keyword, for example Qt integration works better if this +is set to ``Qt4VSv1.0``. -VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER and -VS_SCC_AUXPATH can be set to add support for source control bindings -in a Visual Studio project file. +:prop_tgt:`VS_SCC_PROJECTNAME`, :prop_tgt:`VS_SCC_LOCALPATH`, +:prop_tgt:`VS_SCC_PROVIDER` and :prop_tgt:`VS_SCC_AUXPATH` can be set to +add support for source control bindings in a Visual Studio project file. -VS_GLOBAL_<variable> can be set to add a Visual Studio +:prop_tgt:`VS_GLOBAL_<variable>` can be set to add a Visual Studio project-specific global variable. Qt integration works better if -VS_GLOBAL_QtVersion is set to the Qt version FindQt4.cmake found. For -example, "4.7.3" +``VS_GLOBAL_QtVersion`` is set to the Qt version :module:`FindQt4` +found. For example, "4.7.3" -The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the old -way to specify CMake scripts to run before and after installing a -target. They are used only when the old INSTALL_TARGETS command is -used to install the target. Use the INSTALL command instead. +The :prop_tgt:`PRE_INSTALL_SCRIPT` and :prop_tgt:`POST_INSTALL_SCRIPT` +properties are the old way to specify CMake scripts to run before and +after installing a target. They are used only when the old +:command:`install_targets` command is used to install the target. Use the +:command:`install` command instead. -The EXCLUDE_FROM_DEFAULT_BUILD property is used by the visual studio -generators. If it is set to 1 the target will not be part of the +The :prop_tgt:`EXCLUDE_FROM_DEFAULT_BUILD` property is used by the visual +studio generators. If it is set to 1 the target will not be part of the default build when you select "Build Solution". This can also be set on a per-configuration basis using -EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG>. +:prop_tgt:`EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG>`. diff --git a/Help/command/string.rst b/Help/command/string.rst index 351385b..34c1b61 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -39,41 +39,41 @@ String operations. string(UUID <output variable> NAMESPACE <namespace> NAME <name> TYPE <MD5|SHA1> [UPPER]) -REGEX MATCH will match the regular expression once and store the match +``REGEX MATCH`` will match the regular expression once and store the match in the output variable. -REGEX MATCHALL will match the regular expression as many times as +``REGEX MATCHALL`` will match the regular expression as many times as possible and store the matches in the output variable as a list. -REGEX REPLACE will match the regular expression as many times as +``REGEX REPLACE`` will match the regular expression as many times as possible and substitute the replacement expression for the match in the output. The replace expression may refer to paren-delimited subexpressions of the match using \1, \2, ..., \9. Note that two backslashes (\\1) are required in CMake code to get a backslash through argument parsing. -REPLACE will replace all occurrences of match_string in the input with -replace_string and store the result in the output. +``REPLACE`` will replace all occurrences of ``match_string`` in the input +with ``replace_string`` and store the result in the output. -CONCAT will concatenate all the input arguments together and store +``CONCAT`` will concatenate all the input arguments together and store the result in the named output variable. -MD5, SHA1, SHA224, SHA256, SHA384, and SHA512 will compute a -cryptographic hash of the input string. +``MD5``, ``SHA1``, ``SHA224``, ``SHA256``, ``SHA384``, and ``SHA512`` will +compute a cryptographic hash of the input string. -COMPARE EQUAL/NOTEQUAL/LESS/GREATER will compare the strings and store -true or false in the output variable. +``COMPARE EQUAL``/``COMPARE NOTEQUAL``/``COMPARE LESS/GREATER`` will +compare the strings and store true or false in the output variable. -ASCII will convert all numbers into corresponding ASCII characters. +``ASCII`` will convert all numbers into corresponding ASCII characters. -CONFIGURE will transform a string like CONFIGURE_FILE transforms a -file. +``CONFIGURE`` will transform a string like :command:`configure_file` +transforms a file. -TOUPPER/TOLOWER will convert string to upper/lower characters. +``TOUPPER``/``TOLOWER`` will convert string to upper/lower characters. -LENGTH will return a given string's length. +``LENGTH`` will return a given string's length. -SUBSTRING will return a substring of a given string. If length is -1 +``SUBSTRING`` will return a substring of a given string. If length is -1 the remainder of the string starting at begin will be returned. If string is shorter than length then end of string is used instead. @@ -81,17 +81,17 @@ If string is shorter than length then end of string is used instead. CMake 3.1 and below reported an error if length pointed past the end of string. -STRIP will return a substring of a given string with leading and +``STRIP`` will return a substring of a given string with leading and trailing spaces removed. -RANDOM will return a random string of given length consisting of +``RANDOM`` will return a random string of given length consisting of characters from the given alphabet. Default length is 5 characters and default alphabet is all numbers and upper and lower case letters. -If an integer RANDOM_SEED is given, its value will be used to seed the +If an integer ``RANDOM_SEED`` is given, its value will be used to seed the random number generator. -FIND will return the position where the given substring was found in -the supplied string. If the REVERSE flag was used, the command will +``FIND`` will return the position where the given substring was found in +the supplied string. If the ``REVERSE`` flag was used, the command will search for the position of the last occurrence of the specified substring. @@ -118,21 +118,21 @@ The following characters have special meaning in regular expressions: by all regular expression-related commands, including e.g. if( MATCHES ), in the variables CMAKE_MATCH_(0..9). -``*``, ``+`` and ``?`` have higher precedence than concatenation. | has lower -precedence than concatenation. This means that the regular expression -"^ab+d$" matches "abbd" but not "ababd", and the regular expression -"^(ab|cd)$" matches "ab" but not "abd". +``*``, ``+`` and ``?`` have higher precedence than concatenation. ``|`` +has lower precedence than concatenation. This means that the regular +expression "^ab+d$" matches "abbd" but not "ababd", and the regular +expression "^(ab|cd)$" matches "ab" but not "abd". -TIMESTAMP will write a string representation of the current date +``TIMESTAMP`` will write a string representation of the current date and/or time to the output variable. Should the command be unable to obtain a timestamp the output variable will be set to the empty string "". -The optional UTC flag requests the current date/time representation to +The optional ``UTC`` flag requests the current date/time representation to be in Coordinated Universal Time (UTC) rather than local time. -The optional <format string> may contain the following format +The optional ``<format string>`` may contain the following format specifiers: :: @@ -153,23 +153,23 @@ specifiers: Unknown format specifiers will be ignored and copied to the output as-is. -If no explicit <format string> is given it will default to: +If no explicit ``<format string>`` is given it will default to: :: %Y-%m-%dT%H:%M:%S for local time. %Y-%m-%dT%H:%M:%SZ for UTC. -MAKE_C_IDENTIFIER will write a string which can be used as an +``MAKE_C_IDENTIFIER`` will write a string which can be used as an identifier in C. ``GENEX_STRIP`` will strip any :manual:`generator expressions <cmake-generator-expressions(7)>` from the ``input string`` and store the result in the ``output variable``. -UUID creates a univerally unique identifier (aka GUID) as per RFC4122 -based on the hash of the combined values of <namespace> -(which itself has to be a valid UUID) and <name>. +``UUID`` creates a univerally unique identifier (aka GUID) as per RFC4122 +based on the hash of the combined values of ``<namespace>`` +(which itself has to be a valid UUID) and ``<name>``. The hash algorithm can be either ``MD5`` (Version 3 UUID) or ``SHA1`` (Version 5 UUID). A UUID has the format ``xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`` diff --git a/Help/command/subdirs.rst b/Help/command/subdirs.rst index dee49f8..43b87d4 100644 --- a/Help/command/subdirs.rst +++ b/Help/command/subdirs.rst @@ -1,7 +1,7 @@ subdirs ------- -Deprecated. Use the add_subdirectory() command instead. +Deprecated. Use the :command:`add_subdirectory` command instead. Add a list of subdirectories to the build. @@ -10,12 +10,12 @@ Add a list of subdirectories to the build. subdirs(dir1 dir2 ...[EXCLUDE_FROM_ALL exclude_dir1 exclude_dir2 ...] [PREORDER] ) -Add a list of subdirectories to the build. The add_subdirectory -command should be used instead of subdirs although subdirs will still +Add a list of subdirectories to the build. The :command:`add_subdirectory` +command should be used instead of ``subdirs`` although ``subdirs`` will still work. This will cause any CMakeLists.txt files in the sub directories -to be processed by CMake. Any directories after the PREORDER flag are -traversed first by makefile builds, the PREORDER flag has no effect on -IDE projects. Any directories after the EXCLUDE_FROM_ALL marker will +to be processed by CMake. Any directories after the ``PREORDER`` flag are +traversed first by makefile builds, the ``PREORDER`` flag has no effect on +IDE projects. Any directories after the ``EXCLUDE_FROM_ALL`` marker will not be included in the top level makefile or project file. This is useful for having CMake create makefiles or projects for a set of examples in a project. You would want CMake to generate makefiles or diff --git a/Help/command/unset.rst b/Help/command/unset.rst index d8f0dcd..a1fc95c 100644 --- a/Help/command/unset.rst +++ b/Help/command/unset.rst @@ -8,14 +8,14 @@ Unset a variable, cache variable, or environment variable. unset(<variable> [CACHE | PARENT_SCOPE]) Removes the specified variable causing it to become undefined. If -CACHE is present then the variable is removed from the cache instead +``CACHE`` is present then the variable is removed from the cache instead of the current scope. -If PARENT_SCOPE is present then the variable is removed from the scope -above the current scope. See the same option in the set() command for -further details. +If ``PARENT_SCOPE`` is present then the variable is removed from the scope +above the current scope. See the same option in the :command:`set` command +for further details. -<variable> can be an environment variable such as: +``<variable>`` can be an environment variable such as: :: diff --git a/Help/command/utility_source.rst b/Help/command/utility_source.rst index 5122e52..ee34492 100644 --- a/Help/command/utility_source.rst +++ b/Help/command/utility_source.rst @@ -12,11 +12,11 @@ Specify the source tree of a third-party utility. When a third-party utility's source is included in the distribution, this command specifies its location and name. The cache entry will -not be set unless the path_to_source and all listed files exist. It +not be set unless the ``path_to_source`` and all listed files exist. It is assumed that the source tree of the utility will have been built before it is needed. -When cross compiling CMake will print a warning if a utility_source() +When cross compiling CMake will print a warning if a ``utility_source()`` command is executed, because in many cases it is used to build an executable which is executed later on. This doesn't work when cross compiling, since the executable can run only on their target platform. diff --git a/Help/command/variable_requires.rst b/Help/command/variable_requires.rst index 831dd00..9cf9f3f 100644 --- a/Help/command/variable_requires.rst +++ b/Help/command/variable_requires.rst @@ -3,7 +3,7 @@ variable_requires Disallowed. See CMake Policy :policy:`CMP0035`. -Use the if() command instead. +Use the :command:`if` command instead. Assert satisfaction of an option's required variables. @@ -13,10 +13,10 @@ Assert satisfaction of an option's required variables. REQUIRED_VARIABLE1 REQUIRED_VARIABLE2 ...) -The first argument (TEST_VARIABLE) is the name of the variable to be +The first argument (``TEST_VARIABLE``) is the name of the variable to be tested, if that variable is false nothing else is done. If -TEST_VARIABLE is true, then the next argument (RESULT_VARIABLE) is a -variable that is set to true if all the required variables are set. +``TEST_VARIABLE`` is true, then the next argument (``RESULT_VARIABLE``) +is a variable that is set to true if all the required variables are set. The rest of the arguments are variables that must be true or not set to NOTFOUND to avoid an error. If any are not true, an error is reported. diff --git a/Help/command/while.rst b/Help/command/while.rst index 72c055d..7509da3 100644 --- a/Help/command/while.rst +++ b/Help/command/while.rst @@ -11,7 +11,7 @@ Evaluate a group of commands while a condition is true ... endwhile(condition) -All commands between while and the matching endwhile are recorded -without being invoked. Once the endwhile is evaluated, the recorded -list of commands is invoked as long as the condition is true. The -condition is evaluated using the same logic as the if command. +All commands between while and the matching :command:`endwhile` are recorded +without being invoked. Once the :command:`endwhile` is evaluated, the +recorded list of commands is invoked as long as the condition is true. The +condition is evaluated using the same logic as the :command:`if` command. diff --git a/Help/command/write_file.rst b/Help/command/write_file.rst index 015514b..40e7557 100644 --- a/Help/command/write_file.rst +++ b/Help/command/write_file.rst @@ -1,20 +1,20 @@ write_file ---------- -Deprecated. Use the file(WRITE ) command instead. +Deprecated. Use the :command:`file(WRITE)` command instead. :: write_file(filename "message to write"... [APPEND]) The first argument is the file name, the rest of the arguments are -messages to write. If the argument APPEND is specified, then the +messages to write. If the argument ``APPEND`` is specified, then the message will be appended. -NOTE 1: file(WRITE ... and file(APPEND ... do exactly the same as -this one but add some more functionality. +NOTE 1: :command:`file(WRITE)` and :command:`file(APPEND)` do exactly +the same as this one but add some more functionality. -NOTE 2: When using write_file the produced file cannot be used as an +NOTE 2: When using ``write_file`` the produced file cannot be used as an input to CMake (CONFIGURE_FILE, source file ...) because it will lead -to an infinite loop. Use configure_file if you want to generate input -files to CMake. +to an infinite loop. Use :command:`configure_file` if you want to +generate input files to CMake. diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index c456590..aefdb71 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -632,7 +632,7 @@ may be enabled, with an equivalent effect to: .. code-block:: cmake - set_property(TARGET tgt APPEND PROPERTY + set_property(TARGET tgt APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR}> ) diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index ab74140..90a081d 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -867,7 +867,6 @@ look. find_path(Foo_INCLUDE_DIR NAMES foo.h PATHS ${PC_Foo_INCLUDE_DIRS} - # if you need to put #include <Foo/foo.h> in your code, add: PATH_SUFFIXES Foo ) find_library(Foo_LIBRARY diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index c5970bb..0a313cd 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -20,11 +20,11 @@ for a policy, also avoiding the warning. Each policy can also be set to either ``NEW`` or ``OLD`` behavior explicitly on the command line with the :variable:`CMAKE_POLICY_DEFAULT_CMP<NNNN>` variable. -Note that policies are not reliable feature toggles. A policy should -almost never be set to ``OLD``, except to silence warnings in an otherwise -frozen or stable codebase, or temporarily as part of a larger migration -path. The ``OLD`` behavior of each policy is undesirable and will be -replaced with an error condition in a future release. +A policy is a deprecation mechanism and not a reliable feature toggle. +A policy should almost never be set to ``OLD``, except to silence warnings +in an otherwise frozen or stable codebase, or temporarily as part of a +larger migration path. The ``OLD`` behavior of each policy is undesirable +and will be replaced with an error condition in a future release. The :command:`cmake_minimum_required` command does more than report an error if a too-old version of CMake is used to build a project. It diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 615254e..9a60a10 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -177,6 +177,7 @@ Properties on Targets /prop_tgt/JOB_POOL_COMPILE /prop_tgt/JOB_POOL_LINK /prop_tgt/LABELS + /prop_tgt/LANG_COMPILER_LAUNCHER /prop_tgt/LANG_INCLUDE_WHAT_YOU_USE /prop_tgt/LANG_VISIBILITY_PRESET /prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index bd02f8b..0e6222f 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -117,6 +117,8 @@ Variables that Change Behavior /variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION /variable/CMAKE_EXPORT_NO_PACKAGE_REGISTRY /variable/CMAKE_SYSROOT + /variable/CMAKE_FIND_APPBUNDLE + /variable/CMAKE_FIND_FRAMEWORK /variable/CMAKE_FIND_LIBRARY_PREFIXES /variable/CMAKE_FIND_LIBRARY_SUFFIXES /variable/CMAKE_FIND_NO_INSTALL_PREFIX @@ -147,6 +149,8 @@ Variables that Change Behavior /variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE /variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY /variable/CMAKE_STAGING_PREFIX + /variable/CMAKE_SYSTEM_APPBUNDLE_PATH + /variable/CMAKE_SYSTEM_FRAMEWORK_PATH /variable/CMAKE_SYSTEM_IGNORE_PATH /variable/CMAKE_SYSTEM_INCLUDE_PATH /variable/CMAKE_SYSTEM_LIBRARY_PATH @@ -235,6 +239,7 @@ Variables that Control the Build /variable/CMAKE_INSTALL_NAME_DIR /variable/CMAKE_INSTALL_RPATH /variable/CMAKE_INSTALL_RPATH_USE_LINK_PATH + /variable/CMAKE_LANG_COMPILER_LAUNCHER /variable/CMAKE_LANG_INCLUDE_WHAT_YOU_USE /variable/CMAKE_LANG_VISIBILITY_PRESET /variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY diff --git a/Help/policy/CMP0000.rst b/Help/policy/CMP0000.rst index 9fbf842..97ea633 100644 --- a/Help/policy/CMP0000.rst +++ b/Help/policy/CMP0000.rst @@ -28,3 +28,5 @@ a warning. An included file may set CMP0000 explicitly to affect how this policy is enforced for the main CMakeLists.txt file. This policy was introduced in CMake version 2.6.0. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0001.rst b/Help/policy/CMP0001.rst index 344f1e2..09ad387 100644 --- a/Help/policy/CMP0001.rst +++ b/Help/policy/CMP0001.rst @@ -17,3 +17,5 @@ below. This policy was introduced in CMake version 2.6.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0002.rst b/Help/policy/CMP0002.rst index 2c15bd4..7cc53ef 100644 --- a/Help/policy/CMP0002.rst +++ b/Help/policy/CMP0002.rst @@ -24,3 +24,5 @@ property ALLOW_DUPLICATE_CUSTOM_TARGETS with a Makefiles generator). This policy was introduced in CMake version 2.6.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0003.rst b/Help/policy/CMP0003.rst index 27b83f8..16b0451 100644 --- a/Help/policy/CMP0003.rst +++ b/Help/policy/CMP0003.rst @@ -100,3 +100,5 @@ when setting the policy once will probably fix all targets. This policy was introduced in CMake version 2.6.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0004.rst b/Help/policy/CMP0004.rst index 80045f5..55da4d2 100644 --- a/Help/policy/CMP0004.rst +++ b/Help/policy/CMP0004.rst @@ -21,3 +21,5 @@ target is created by an add_executable or add_library command. This policy was introduced in CMake version 2.6.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0005.rst b/Help/policy/CMP0005.rst index c11a9e6..66d125f 100644 --- a/Help/policy/CMP0005.rst +++ b/Help/policy/CMP0005.rst @@ -22,3 +22,5 @@ limitations of the escaping implementation. This policy was introduced in CMake version 2.6.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0006.rst b/Help/policy/CMP0006.rst index 8d1e5bd..d1b9ece 100644 --- a/Help/policy/CMP0006.rst +++ b/Help/policy/CMP0006.rst @@ -20,3 +20,5 @@ without a BUNDLE DESTINATION. This policy was introduced in CMake version 2.6.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0007.rst b/Help/policy/CMP0007.rst index f0d8c16..3927645 100644 --- a/Help/policy/CMP0007.rst +++ b/Help/policy/CMP0007.rst @@ -13,3 +13,5 @@ empty elements in a list. This policy was introduced in CMake version 2.6.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0008.rst b/Help/policy/CMP0008.rst index b118ece..f1e2ddd 100644 --- a/Help/policy/CMP0008.rst +++ b/Help/policy/CMP0008.rst @@ -30,3 +30,5 @@ pass it directly to the native build tool unchanged. This policy was introduced in CMake version 2.6.1. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0009.rst b/Help/policy/CMP0009.rst index 481af1a..44baeb4 100644 --- a/Help/policy/CMP0009.rst +++ b/Help/policy/CMP0009.rst @@ -17,3 +17,5 @@ as an additional argument to the FILE command. This policy was introduced in CMake version 2.6.2. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0010.rst b/Help/policy/CMP0010.rst index 9d2eb76..344d704 100644 --- a/Help/policy/CMP0010.rst +++ b/Help/policy/CMP0010.rst @@ -16,3 +16,5 @@ and is treated as always being ``NEW``. This policy was introduced in CMake version 2.6.3. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0011.rst b/Help/policy/CMP0011.rst index 0f41fff..d281e0e 100644 --- a/Help/policy/CMP0011.rst +++ b/Help/policy/CMP0011.rst @@ -20,3 +20,5 @@ cmake_policy PUSH and POP. This policy was introduced in CMake version 2.6.3. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0012.rst b/Help/policy/CMP0012.rst index 7a749bf..85d64f4 100644 --- a/Help/policy/CMP0012.rst +++ b/Help/policy/CMP0012.rst @@ -23,3 +23,5 @@ dereferencing variables with such names. This policy was introduced in CMake version 2.8.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0013.rst b/Help/policy/CMP0013.rst index e99997b..2fabb89 100644 --- a/Help/policy/CMP0013.rst +++ b/Help/policy/CMP0013.rst @@ -17,3 +17,5 @@ with an error. This policy was introduced in CMake version 2.8.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0014.rst b/Help/policy/CMP0014.rst index 37178d1..f1f7b77 100644 --- a/Help/policy/CMP0014.rst +++ b/Help/policy/CMP0014.rst @@ -13,3 +13,5 @@ behavior for this policy is to report an error. This policy was introduced in CMake version 2.8.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0015.rst b/Help/policy/CMP0015.rst index 1b54979..9a48e3d 100644 --- a/Help/policy/CMP0015.rst +++ b/Help/policy/CMP0015.rst @@ -15,3 +15,5 @@ paths by appending the relative path to CMAKE_CURRENT_SOURCE_DIR. This policy was introduced in CMake version 2.8.1. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0016.rst b/Help/policy/CMP0016.rst index 743b1a9..cc898c8 100644 --- a/Help/policy/CMP0016.rst +++ b/Help/policy/CMP0016.rst @@ -11,3 +11,5 @@ in this case. This policy was introduced in CMake version 2.8.3. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0017.rst b/Help/policy/CMP0017.rst index f74e6f0..9f0f038 100644 --- a/Help/policy/CMP0017.rst +++ b/Help/policy/CMP0017.rst @@ -17,3 +17,5 @@ from the CMake modules directory. This policy was introduced in CMake version 2.8.4. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0018.rst b/Help/policy/CMP0018.rst index 0f68267..a3a7a12 100644 --- a/Help/policy/CMP0018.rst +++ b/Help/policy/CMP0018.rst @@ -30,3 +30,5 @@ honor the POSITION_INDEPENDENT_CODE target property. This policy was introduced in CMake version 2.8.9. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0019.rst b/Help/policy/CMP0019.rst index 2b37fa1..2e3557d 100644 --- a/Help/policy/CMP0019.rst +++ b/Help/policy/CMP0019.rst @@ -18,3 +18,5 @@ the values untouched. This policy was introduced in CMake version 2.8.11. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0020.rst b/Help/policy/CMP0020.rst index 6767d08..75ca9de 100644 --- a/Help/policy/CMP0020.rst +++ b/Help/policy/CMP0020.rst @@ -23,3 +23,5 @@ automatically when they link to QtCore IMPORTED target. This policy was introduced in CMake version 2.8.11. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0021.rst b/Help/policy/CMP0021.rst index 3f5bd03..3a792ca 100644 --- a/Help/policy/CMP0021.rst +++ b/Help/policy/CMP0021.rst @@ -16,3 +16,5 @@ relative path. This policy was introduced in CMake version 2.8.12. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0022.rst b/Help/policy/CMP0022.rst index 22c7c4f..579d09a 100644 --- a/Help/policy/CMP0022.rst +++ b/Help/policy/CMP0022.rst @@ -35,3 +35,5 @@ property for in-build targets, and ignore the old properties matching This policy was introduced in CMake version 2.8.12. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0023.rst b/Help/policy/CMP0023.rst index 962b624..76a4900 100644 --- a/Help/policy/CMP0023.rst +++ b/Help/policy/CMP0023.rst @@ -31,3 +31,5 @@ signatures. This policy was introduced in CMake version 2.8.12. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0024.rst b/Help/policy/CMP0024.rst index ee53d5f..272a56c 100644 --- a/Help/policy/CMP0024.rst +++ b/Help/policy/CMP0024.rst @@ -20,3 +20,5 @@ allow including the result of an export() command. This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0025.rst b/Help/policy/CMP0025.rst index 8d19edf..62dd509 100644 --- a/Help/policy/CMP0025.rst +++ b/Help/policy/CMP0025.rst @@ -25,3 +25,5 @@ by default when this policy is not set and simply uses OLD behavior. See documentation of the :variable:`CMAKE_POLICY_WARNING_CMP0025 <CMAKE_POLICY_WARNING_CMP<NNNN>>` variable to control the warning. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0026.rst b/Help/policy/CMP0026.rst index 4889249..3fe1374 100644 --- a/Help/policy/CMP0026.rst +++ b/Help/policy/CMP0026.rst @@ -24,3 +24,5 @@ not to allow reading the LOCATION properties from build-targets. This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0027.rst b/Help/policy/CMP0027.rst index bedaffe..28913ce 100644 --- a/Help/policy/CMP0027.rst +++ b/Help/policy/CMP0027.rst @@ -23,3 +23,5 @@ conditionally linked IMPORTED target does not exist. This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0028.rst b/Help/policy/CMP0028.rst index 24889ec..be57125 100644 --- a/Help/policy/CMP0028.rst +++ b/Help/policy/CMP0028.rst @@ -21,3 +21,5 @@ double-colons but is not an IMPORTED target or an ALIAS target. This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0029.rst b/Help/policy/CMP0029.rst index 8f58a12..aa10b97 100644 --- a/Help/policy/CMP0029.rst +++ b/Help/policy/CMP0029.rst @@ -8,3 +8,5 @@ but was kept in CMake for compatibility for a long time. .. |disallowed_version| replace:: 3.0 .. include:: DISALLOWED_COMMAND.txt + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0030.rst b/Help/policy/CMP0030.rst index 9e31b38..81bbb84 100644 --- a/Help/policy/CMP0030.rst +++ b/Help/policy/CMP0030.rst @@ -9,3 +9,5 @@ not used it in years. .. |disallowed_version| replace:: 3.0 .. include:: DISALLOWED_COMMAND.txt + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0031.rst b/Help/policy/CMP0031.rst index 6b89558..8c3eef6 100644 --- a/Help/policy/CMP0031.rst +++ b/Help/policy/CMP0031.rst @@ -11,3 +11,5 @@ the CMake process. It has been mostly superseded by the .. |disallowed_version| replace:: 3.0 .. include:: DISALLOWED_COMMAND.txt + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0032.rst b/Help/policy/CMP0032.rst index f394a06..5c1fa4b 100644 --- a/Help/policy/CMP0032.rst +++ b/Help/policy/CMP0032.rst @@ -11,3 +11,5 @@ functionality is better achieved through dedicated outside tools. .. |disallowed_version| replace:: 3.0 .. include:: DISALLOWED_COMMAND.txt + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0033.rst b/Help/policy/CMP0033.rst index b420065..4a6cc59 100644 --- a/Help/policy/CMP0033.rst +++ b/Help/policy/CMP0033.rst @@ -12,3 +12,5 @@ The functionality has been superseded by the :command:`export` and .. |disallowed_version| replace:: 3.0 .. include:: DISALLOWED_COMMAND.txt + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0034.rst b/Help/policy/CMP0034.rst index 2133997..0f3934a 100644 --- a/Help/policy/CMP0034.rst +++ b/Help/policy/CMP0034.rst @@ -9,3 +9,5 @@ generate other files. This approach has long been replaced by .. |disallowed_version| replace:: 3.0 .. include:: DISALLOWED_COMMAND.txt + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0035.rst b/Help/policy/CMP0035.rst index 7335b22..58199a4 100644 --- a/Help/policy/CMP0035.rst +++ b/Help/policy/CMP0035.rst @@ -8,3 +8,5 @@ logic. It has long been replaced by the :command:`if` command. .. |disallowed_version| replace:: 3.0 .. include:: DISALLOWED_COMMAND.txt + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0036.rst b/Help/policy/CMP0036.rst index 817f156..4bcfc54 100644 --- a/Help/policy/CMP0036.rst +++ b/Help/policy/CMP0036.rst @@ -10,3 +10,5 @@ and :variable:`CMAKE_<LANG>_COMPILER` variables. .. |disallowed_version| replace:: 3.0 .. include:: DISALLOWED_COMMAND.txt + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0037.rst b/Help/policy/CMP0037.rst index 4d485bf..9f8457c 100644 --- a/Help/policy/CMP0037.rst +++ b/Help/policy/CMP0037.rst @@ -24,3 +24,5 @@ if an add_* command is used with an invalid target name. This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0038.rst b/Help/policy/CMP0038.rst index df5af6a..a306d90 100644 --- a/Help/policy/CMP0038.rst +++ b/Help/policy/CMP0038.rst @@ -14,3 +14,5 @@ report an error if a target attempts to link to itself. This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0039.rst b/Help/policy/CMP0039.rst index 58ccc41..97d78ae 100644 --- a/Help/policy/CMP0039.rst +++ b/Help/policy/CMP0039.rst @@ -15,3 +15,5 @@ utility target. This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0040.rst b/Help/policy/CMP0040.rst index 77a3c81..e746c03 100644 --- a/Help/policy/CMP0040.rst +++ b/Help/policy/CMP0040.rst @@ -14,3 +14,5 @@ if the target referenced in :command:`add_custom_command` is unknown. This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0041.rst b/Help/policy/CMP0041.rst index 5a47de0..f027d5d 100644 --- a/Help/policy/CMP0041.rst +++ b/Help/policy/CMP0041.rst @@ -23,3 +23,5 @@ relative. This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0042.rst b/Help/policy/CMP0042.rst index fce870c..31314b2 100644 --- a/Help/policy/CMP0042.rst +++ b/Help/policy/CMP0042.rst @@ -17,3 +17,5 @@ variables. This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0043.rst b/Help/policy/CMP0043.rst index 629e502..9e427c3 100644 --- a/Help/policy/CMP0043.rst +++ b/Help/policy/CMP0043.rst @@ -43,3 +43,5 @@ of the :prop_tgt:`COMPILE_DEFINITIONS_<CONFIG>` target property . This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0044.rst b/Help/policy/CMP0044.rst index 4a3e215..02afa9f 100644 --- a/Help/policy/CMP0044.rst +++ b/Help/policy/CMP0044.rst @@ -17,3 +17,5 @@ the ``<LANG>_COMPILER_ID`` expression. This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0045.rst b/Help/policy/CMP0045.rst index 58c422f..c7e1a90f6 100644 --- a/Help/policy/CMP0045.rst +++ b/Help/policy/CMP0045.rst @@ -15,3 +15,5 @@ non-existent target. This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0046.rst b/Help/policy/CMP0046.rst index 1a3bc65..576d1b1 100644 --- a/Help/policy/CMP0046.rst +++ b/Help/policy/CMP0046.rst @@ -15,3 +15,5 @@ This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0047.rst b/Help/policy/CMP0047.rst index 26ae439..882dd78 100644 --- a/Help/policy/CMP0047.rst +++ b/Help/policy/CMP0047.rst @@ -26,3 +26,5 @@ by default when this policy is not set and simply uses OLD behavior. See documentation of the :variable:`CMAKE_POLICY_WARNING_CMP0047 <CMAKE_POLICY_WARNING_CMP<NNNN>>` variable to control the warning. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0048.rst b/Help/policy/CMP0048.rst index a54205e..0e7e606 100644 --- a/Help/policy/CMP0048.rst +++ b/Help/policy/CMP0048.rst @@ -20,3 +20,5 @@ This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0049.rst b/Help/policy/CMP0049.rst index 5c8d4a8..a3ce4b1 100644 --- a/Help/policy/CMP0049.rst +++ b/Help/policy/CMP0049.rst @@ -21,3 +21,5 @@ This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0050.rst b/Help/policy/CMP0050.rst index 76ae0aa..39e40b6 100644 --- a/Help/policy/CMP0050.rst +++ b/Help/policy/CMP0050.rst @@ -16,3 +16,5 @@ This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0051.rst b/Help/policy/CMP0051.rst index 1b56cb0..6b679e5 100644 --- a/Help/policy/CMP0051.rst +++ b/Help/policy/CMP0051.rst @@ -22,3 +22,5 @@ This policy was introduced in CMake version 3.1. CMake version |release| warns when the policy is not set and uses ``OLD`` behavior. Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0052.rst b/Help/policy/CMP0052.rst index 48cfc9c..0ea5ace 100644 --- a/Help/policy/CMP0052.rst +++ b/Help/policy/CMP0052.rst @@ -22,3 +22,5 @@ This policy was introduced in CMake version 3.1. CMake version |release| warns when the policy is not set and uses ``OLD`` behavior. Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0053.rst b/Help/policy/CMP0053.rst index bb0ff8b..2620a60 100644 --- a/Help/policy/CMP0053.rst +++ b/Help/policy/CMP0053.rst @@ -42,3 +42,5 @@ This policy was introduced in CMake version 3.1. CMake version |release| warns when the policy is not set and uses ``OLD`` behavior. Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0054.rst b/Help/policy/CMP0054.rst index 3754fda..1e000a6 100644 --- a/Help/policy/CMP0054.rst +++ b/Help/policy/CMP0054.rst @@ -48,3 +48,5 @@ This policy was introduced in CMake version 3.1. CMake version |release| warns when the policy is not set and uses ``OLD`` behavior. Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0055.rst b/Help/policy/CMP0055.rst index fe7ab6f..b3df758 100644 --- a/Help/policy/CMP0055.rst +++ b/Help/policy/CMP0055.rst @@ -15,3 +15,5 @@ This policy was introduced in CMake version 3.2. CMake version |release| warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0056.rst b/Help/policy/CMP0056.rst index 3c75ff4..3ba89d5 100644 --- a/Help/policy/CMP0056.rst +++ b/Help/policy/CMP0056.rst @@ -30,3 +30,5 @@ CMake version |release| does *not* warn by default when this policy is not set and simply uses OLD behavior. See documentation of the :variable:`CMAKE_POLICY_WARNING_CMP0056 <CMAKE_POLICY_WARNING_CMP<NNNN>>` variable to control the warning. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0057.rst b/Help/policy/CMP0057.rst index 1298a16..83db186 100644 --- a/Help/policy/CMP0057.rst +++ b/Help/policy/CMP0057.rst @@ -12,3 +12,5 @@ This policy was introduced in CMake version 3.3. CMake version |release| warns when the policy is not set and uses ``OLD`` behavior. Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0058.rst b/Help/policy/CMP0058.rst index 0f20383..05efd48 100644 --- a/Help/policy/CMP0058.rst +++ b/Help/policy/CMP0058.rst @@ -106,3 +106,5 @@ out-of-source build trees if the policy is not set and then uses the policy to ``OLD`` or ``NEW`` explicitly. The policy setting must be in scope at the end of the top-level ``CMakeLists.txt`` file of the project and has global effect. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0059.rst b/Help/policy/CMP0059.rst index e40f450..5da479a 100644 --- a/Help/policy/CMP0059.rst +++ b/Help/policy/CMP0059.rst @@ -15,3 +15,5 @@ This policy was introduced in CMake version 3.3. CMake version |release| warns when the policy is not set and uses ``OLD`` behavior. Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0060.rst b/Help/policy/CMP0060.rst index cc37b1b..8611aff 100644 --- a/Help/policy/CMP0060.rst +++ b/Help/policy/CMP0060.rst @@ -61,3 +61,5 @@ CMake version |release| does *not* warn by default when this policy is not set and simply uses OLD behavior. See documentation of the :variable:`CMAKE_POLICY_WARNING_CMP0060 <CMAKE_POLICY_WARNING_CMP<NNNN>>` variable to control the warning. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0061.rst b/Help/policy/CMP0061.rst index 069a1ab..cb2ac28 100644 --- a/Help/policy/CMP0061.rst +++ b/Help/policy/CMP0061.rst @@ -22,3 +22,5 @@ add ``-i``. This policy was introduced in CMake version 3.3. Unlike most policies, CMake version |release| does *not* warn when this policy is not set and simply uses OLD behavior. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0062.rst b/Help/policy/CMP0062.rst index e2f5a5a..9047fff 100644 --- a/Help/policy/CMP0062.rst +++ b/Help/policy/CMP0062.rst @@ -25,3 +25,5 @@ This policy was introduced in CMake version 3.3. CMake version |release| warns when the policy is not set and uses ``OLD`` behavior. Use the :command:`cmake_policy()` command to set it to ``OLD`` or ``NEW`` explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0063.rst b/Help/policy/CMP0063.rst index 298e9c2..d736d06 100644 --- a/Help/policy/CMP0063.rst +++ b/Help/policy/CMP0063.rst @@ -24,3 +24,5 @@ This policy was introduced in CMake version 3.3. CMake version |release| warns when the policy is not set and uses ``OLD`` behavior. Use the :command:`cmake_policy()` command to set it to ``OLD`` or ``NEW`` explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/DEPRECATED.txt b/Help/policy/DEPRECATED.txt new file mode 100644 index 0000000..f66de55 --- /dev/null +++ b/Help/policy/DEPRECATED.txt @@ -0,0 +1,4 @@ +.. note:: + The ``OLD`` behavior of a policy is + :manual:`deprecated by definition <cmake-policies(7)>` + and may be removed in a future version of CMake. diff --git a/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst new file mode 100644 index 0000000..0fe0b31 --- /dev/null +++ b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst @@ -0,0 +1,13 @@ +<LANG>_COMPILER_LAUNCHER +------------------------ + +This property is implemented only when ``<LANG>`` is ``C`` or ``CXX``. + +Specify a :ref:`;-list <CMake Language Lists>` containing a command line +for a compiler launching tool. The :ref:`Makefile Generators` and the +:generator:`Ninja` generator will run this tool and pass the compiler and +its arguments to the tool. Some example tools are distcc and ccache. + +This property is initialized by the value of +the :variable:`CMAKE_<LANG>_COMPILER_LAUNCHER` variable if it is set +when a target is created. diff --git a/Help/release/3.3.rst b/Help/release/3.3.rst index 15127cc..0beb354 100644 --- a/Help/release/3.3.rst +++ b/Help/release/3.3.rst @@ -251,12 +251,6 @@ Deprecated and Removed Features Projects may populate the :ref:`User Package Registry` to aid users building multiple dependent projects one after another. -* When building with GNU tools on Windows (MinGW tools), the - :command:`find_library` command will no longer consider - ``.dll`` files to be linkable libraries. All dynamic link - libraries are expected to provide separate ``.dll.a`` or - ``.lib`` import libraries. - * The :command:`add_definitions()` command no longer causes a :prop_dir:`DEFINITIONS` directory property to be populated. See policy :policy:`CMP0059`. diff --git a/Help/release/dev/ConcurrentFortran-compiler-id.rst b/Help/release/dev/ConcurrentFortran-compiler-id.rst new file mode 100644 index 0000000..71e79aa --- /dev/null +++ b/Help/release/dev/ConcurrentFortran-compiler-id.rst @@ -0,0 +1,5 @@ +ConcurrentFortran-compiler-id +----------------------------- + +* The `Concurrent Fortran 77 <https://ccur.com>`__ compiler is now supported. + Its :variable:`compiler id <CMAKE_<LANG>_COMPILER_ID>` is ``CCur``. diff --git a/Help/release/dev/ExternalProject_init_selected_submodules.rst b/Help/release/dev/ExternalProject_init_selected_submodules.rst new file mode 100644 index 0000000..e642c19 --- /dev/null +++ b/Help/release/dev/ExternalProject_init_selected_submodules.rst @@ -0,0 +1,7 @@ +ExternalProject_init_selected_submodules +---------------------------------------- + +* The :module:`ExternalProject` module :command:`ExternalProject_Add` + function ``GIT_SUBMODULES`` option now also limits the set of + submodules that are initialized in addition to the prior behavior + of limiting the set of submodules that are updated. diff --git a/Help/release/dev/FindBISON-DEFINES_FILE.rst b/Help/release/dev/FindBISON-DEFINES_FILE.rst new file mode 100644 index 0000000..815d560 --- /dev/null +++ b/Help/release/dev/FindBISON-DEFINES_FILE.rst @@ -0,0 +1,6 @@ +FindBISON-DEFINES_FILE +---------------------- + +* The :module:`FindBISON` module ``BISON_TARGET`` macro learned a + new ``DEFINES_FILE`` option to specify a custom output header + to be generated. diff --git a/Help/release/dev/GNUInstallDirs-special-prefixes.rst b/Help/release/dev/GNUInstallDirs-special-prefixes.rst new file mode 100644 index 0000000..83c1352 --- /dev/null +++ b/Help/release/dev/GNUInstallDirs-special-prefixes.rst @@ -0,0 +1,9 @@ +GNUInstallDirs-special-prefixes +------------------------------- + +* The :module:`GNUInstallDirs` module learned special default values + for certain installation prefixes according to the `GNU Coding + Standards`_ and the `Filesystem Hierarchy Standard`_. + +.. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html +.. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html diff --git a/Help/release/dev/compiler-launcher.rst b/Help/release/dev/compiler-launcher.rst new file mode 100644 index 0000000..3ba692d --- /dev/null +++ b/Help/release/dev/compiler-launcher.rst @@ -0,0 +1,8 @@ +compiler-launcher +----------------- + +* The :ref:`Makefile Generators` and the :generator:`Ninja` generator + learned to add compiler launcher tools like distcc and ccache along with the + compiler for ``C`` and ``CXX`` languages. See the + :variable:`CMAKE_<LANG>_COMPILER_LAUNCHER` variable and + :prop_tgt:`<LANG>_COMPILER_LAUNCHER` target property for details. diff --git a/Help/release/dev/remove-CMAKE_USE_RELATIVE_PATHS.rst b/Help/release/dev/remove-CMAKE_USE_RELATIVE_PATHS.rst new file mode 100644 index 0000000..dd52ace --- /dev/null +++ b/Help/release/dev/remove-CMAKE_USE_RELATIVE_PATHS.rst @@ -0,0 +1,5 @@ +remove-CMAKE_USE_RELATIVE_PATHS +------------------------------- + +* The :variable:`CMAKE_USE_RELATIVE_PATHS` variable no longer has any + effect. Previously it was partially implemented and unreliable. diff --git a/Help/variable/CMAKE_APPBUNDLE_PATH.rst b/Help/variable/CMAKE_APPBUNDLE_PATH.rst index 469b316..2bc79ac 100644 --- a/Help/variable/CMAKE_APPBUNDLE_PATH.rst +++ b/Help/variable/CMAKE_APPBUNDLE_PATH.rst @@ -1,5 +1,6 @@ CMAKE_APPBUNDLE_PATH -------------------- -Search path for OS X application bundles used by the :command:`find_program`, -and :command:`find_package` commands. +:ref:`;-list <CMake Language Lists>` of directories specifying a search path +for OS X application bundles used by the :command:`find_program`, and +:command:`find_package` commands. diff --git a/Help/variable/CMAKE_FIND_APPBUNDLE.rst b/Help/variable/CMAKE_FIND_APPBUNDLE.rst new file mode 100644 index 0000000..e0727b5 --- /dev/null +++ b/Help/variable/CMAKE_FIND_APPBUNDLE.rst @@ -0,0 +1,22 @@ +CMAKE_FIND_APPBUNDLE +-------------------- + +This variable affects how ``find_*`` commands choose between +OS X Application Bundles and unix-style package components. + +On Darwin or systems supporting OS X Application Bundles, the +``CMAKE_FIND_APPBUNDLE`` variable can be set to empty or +one of the following: + +``FIRST`` + Try to find application bundles before standard programs. + This is the default on Darwin. + +``LAST`` + Try to find application bundles after standard programs. + +``ONLY`` + Only try to find application bundles. + +``NEVER`` + Never try to find application bundles. diff --git a/Help/variable/CMAKE_FIND_FRAMEWORK.rst b/Help/variable/CMAKE_FIND_FRAMEWORK.rst new file mode 100644 index 0000000..790694a --- /dev/null +++ b/Help/variable/CMAKE_FIND_FRAMEWORK.rst @@ -0,0 +1,22 @@ +CMAKE_FIND_FRAMEWORK +-------------------- + +This variable affects how ``find_*`` commands choose between +OS X Frameworks and unix-style package components. + +On Darwin or systems supporting OS X Frameworks, the +``CMAKE_FIND_FRAMEWORK`` variable can be set to empty or +one of the following: + +``FIRST`` + Try to find frameworks before standard libraries or headers. + This is the default on Darwin. + +``LAST`` + Try to find frameworks after standard libraries or headers. + +``ONLY`` + Only try to find frameworks. + +``NEVER`` + Never try to find frameworks. diff --git a/Help/variable/CMAKE_FIND_ROOT_PATH.rst b/Help/variable/CMAKE_FIND_ROOT_PATH.rst index 67948f7..ccf5234 100644 --- a/Help/variable/CMAKE_FIND_ROOT_PATH.rst +++ b/Help/variable/CMAKE_FIND_ROOT_PATH.rst @@ -1,7 +1,7 @@ CMAKE_FIND_ROOT_PATH -------------------- -List of root paths to search on the filesystem. +:ref:`;-list <CMake Language Lists>` of root paths to search on the filesystem. This variable is most useful when cross-compiling. CMake uses the paths in this list as alternative roots to find filesystem items with :command:`find_package`, diff --git a/Help/variable/CMAKE_FRAMEWORK_PATH.rst b/Help/variable/CMAKE_FRAMEWORK_PATH.rst index f1bc75e..5ff08e6 100644 --- a/Help/variable/CMAKE_FRAMEWORK_PATH.rst +++ b/Help/variable/CMAKE_FRAMEWORK_PATH.rst @@ -1,6 +1,7 @@ CMAKE_FRAMEWORK_PATH -------------------- -Search path for OS X frameworks used by the :command:`find_library`, +:ref:`;-list <CMake Language Lists>` of directories specifying a search path +for OS X frameworks used by the :command:`find_library`, :command:`find_package`, :command:`find_path`, and :command:`find_file` commands. diff --git a/Help/variable/CMAKE_GENERATOR_PLATFORM.rst b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst index 5809b6a..5559eb7 100644 --- a/Help/variable/CMAKE_GENERATOR_PLATFORM.rst +++ b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst @@ -5,7 +5,7 @@ Generator-specific target platform name specified by user. Some CMake generators support a target platform name to be given to the native build system to choose a compiler toolchain. -If the user specifies a toolset name (e.g. via the cmake -A option) +If the user specifies a platform name (e.g. via the cmake -A option) the value will be available in this variable. The value of this variable should never be modified by project code. diff --git a/Help/variable/CMAKE_IGNORE_PATH.rst b/Help/variable/CMAKE_IGNORE_PATH.rst index a818f74..92f3770 100644 --- a/Help/variable/CMAKE_IGNORE_PATH.rst +++ b/Help/variable/CMAKE_IGNORE_PATH.rst @@ -1,17 +1,18 @@ CMAKE_IGNORE_PATH ----------------- -Path to be ignored by FIND_XXX() commands. +:ref:`;-list <CMake Language Lists>` of directories to be *ignored* by +the :command:`find_program`, :command:`find_library`, :command:`find_file`, +and :command:`find_path` commands. This is useful in cross-compiling +environments where some system directories contain incompatible but +possibly linkable libraries. For example, on cross-compiled cluster +environments, this allows a user to ignore directories containing +libraries meant for the front-end machine. -Specifies directories to be ignored by searches in FIND_XXX() -commands. This is useful in cross-compiled environments where some -system directories contain incompatible but possibly linkable -libraries. For example, on cross-compiled cluster environments, this -allows a user to ignore directories containing libraries meant for the -front-end machine that modules like FindX11 (and others) would -normally search. By default this is empty; it is intended to be set -by the project. Note that CMAKE_IGNORE_PATH takes a list of directory -names, NOT a list of prefixes. If you want to ignore paths under -prefixes (bin, include, lib, etc.), you'll need to specify them -explicitly. See also CMAKE_PREFIX_PATH, CMAKE_LIBRARY_PATH, -CMAKE_INCLUDE_PATH, CMAKE_PROGRAM_PATH. +By default this is empty; it is intended to be set by the project. +Note that ``CMAKE_IGNORE_PATH`` takes a list of directory names, *not* +a list of prefixes. To ignore paths under prefixes (``bin``, ``include``, +``lib``, etc.), specify them explicitly. + +See also the :variable:`CMAKE_PREFIX_PATH`, :variable:`CMAKE_LIBRARY_PATH`, +:variable:`CMAKE_INCLUDE_PATH`, and :variable:`CMAKE_PROGRAM_PATH` variables. diff --git a/Help/variable/CMAKE_INCLUDE_PATH.rst b/Help/variable/CMAKE_INCLUDE_PATH.rst index 360b403..e4e7f2c 100644 --- a/Help/variable/CMAKE_INCLUDE_PATH.rst +++ b/Help/variable/CMAKE_INCLUDE_PATH.rst @@ -1,10 +1,7 @@ CMAKE_INCLUDE_PATH ------------------ -Path used for searching by FIND_FILE() and FIND_PATH(). - -Specifies a path which will be used both by FIND_FILE() and -FIND_PATH(). Both commands will check each of the contained -directories for the existence of the file which is currently searched. -By default it is empty, it is intended to be set by the project. See -also CMAKE_SYSTEM_INCLUDE_PATH, CMAKE_PREFIX_PATH. +:ref:`;-list <CMake Language Lists>` of directories specifying a search path +for the :command:`find_file` and :command:`find_path` commands. By default it +is empty, it is intended to be set by the project. See also +:variable:`CMAKE_SYSTEM_INCLUDE_PATH` and :variable:`CMAKE_PREFIX_PATH`. diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst index f554f4e..1c3b134 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst @@ -11,6 +11,7 @@ include: Absoft = Absoft Fortran (absoft.com) ADSP = Analog VisualDSP++ (analog.com) AppleClang = Apple Clang (apple.com) + CCur = Concurrent Fortran (ccur.com) Clang = LLVM Clang (clang.llvm.org) Cray = Cray Compiler (cray.com) Embarcadero, Borland = Embarcadero (embarcadero.com) diff --git a/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst new file mode 100644 index 0000000..7961f60 --- /dev/null +++ b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst @@ -0,0 +1,6 @@ +CMAKE_<LANG>_COMPILER_LAUNCHER +------------------------------ + +Default value for :prop_tgt:`<LANG>_COMPILER_LAUNCHER` target property. +This variable is used to initialize the property on each target as it is +created. This is done only when ``<LANG>`` is ``C`` or ``CXX``. diff --git a/Help/variable/CMAKE_LIBRARY_PATH.rst b/Help/variable/CMAKE_LIBRARY_PATH.rst index e77dd34..b1770dc 100644 --- a/Help/variable/CMAKE_LIBRARY_PATH.rst +++ b/Help/variable/CMAKE_LIBRARY_PATH.rst @@ -1,10 +1,7 @@ CMAKE_LIBRARY_PATH ------------------ -Path used for searching by FIND_LIBRARY(). - -Specifies a path which will be used by FIND_LIBRARY(). FIND_LIBRARY() -will check each of the contained directories for the existence of the -library which is currently searched. By default it is empty, it is +:ref:`;-list <CMake Language Lists>` of directories specifying a search path +for the :command:`find_library` command. By default it is empty, it is intended to be set by the project. See also -CMAKE_SYSTEM_LIBRARY_PATH, CMAKE_PREFIX_PATH. +:variable:`CMAKE_SYSTEM_LIBRARY_PATH` and :variable:`CMAKE_PREFIX_PATH`. diff --git a/Help/variable/CMAKE_MODULE_PATH.rst b/Help/variable/CMAKE_MODULE_PATH.rst index a2dde45..5ea7cbb 100644 --- a/Help/variable/CMAKE_MODULE_PATH.rst +++ b/Help/variable/CMAKE_MODULE_PATH.rst @@ -1,8 +1,7 @@ CMAKE_MODULE_PATH ----------------- -List of directories to search for CMake modules. - -Commands like include() and find_package() search for files in -directories listed by this variable before checking the default -modules that come with CMake. +:ref:`;-list <CMake Language Lists>` of directories specifying a search path +for CMake modules to be loaded by the the :command:`include` or +:command:`find_package` commands before checking the default modules that come +with CMake. By default it is empty, it is intended to be set by the project. diff --git a/Help/variable/CMAKE_PREFIX_PATH.rst b/Help/variable/CMAKE_PREFIX_PATH.rst index 4c21d5e..c2a4a60 100644 --- a/Help/variable/CMAKE_PREFIX_PATH.rst +++ b/Help/variable/CMAKE_PREFIX_PATH.rst @@ -1,13 +1,15 @@ CMAKE_PREFIX_PATH ----------------- -Path used for searching by FIND_XXX(), with appropriate suffixes added. +:ref:`;-list <CMake Language Lists>` of directories specifying installation +*prefixes* to be searched by the :command:`find_package`, +:command:`find_program`, :command:`find_library`, :command:`find_file`, and +:command:`find_path` commands. Each command will add appropriate +subdirectories (like ``bin``, ``lib``, or ``include``) as specified in its own +documentation. -Specifies a path which will be used by the FIND_XXX() commands. It -contains the "base" directories, the FIND_XXX() commands append -appropriate subdirectories to the base directories. So FIND_PROGRAM() -adds /bin to each of the directories in the path, FIND_LIBRARY() -appends /lib to each of the directories, and FIND_PATH() and -FIND_FILE() append /include . By default it is empty, it is intended -to be set by the project. See also CMAKE_SYSTEM_PREFIX_PATH, -CMAKE_INCLUDE_PATH, CMAKE_LIBRARY_PATH, CMAKE_PROGRAM_PATH. +By default this is empty. It is intended to be set by the project. + +See also :variable:`CMAKE_SYSTEM_PREFIX_PATH`, :variable:`CMAKE_INCLUDE_PATH`, +:variable:`CMAKE_LIBRARY_PATH`, :variable:`CMAKE_PROGRAM_PATH`, and +:variable:`CMAKE_IGNORE_PATH`. diff --git a/Help/variable/CMAKE_PROGRAM_PATH.rst b/Help/variable/CMAKE_PROGRAM_PATH.rst index 02c5e02..799e119 100644 --- a/Help/variable/CMAKE_PROGRAM_PATH.rst +++ b/Help/variable/CMAKE_PROGRAM_PATH.rst @@ -1,10 +1,7 @@ CMAKE_PROGRAM_PATH ------------------ -Path used for searching by FIND_PROGRAM(). - -Specifies a path which will be used by FIND_PROGRAM(). FIND_PROGRAM() -will check each of the contained directories for the existence of the -program which is currently searched. By default it is empty, it is +:ref:`;-list <CMake Language Lists>` of directories specifying a search path +for the :command:`find_program` command. By default it is empty, it is intended to be set by the project. See also -CMAKE_SYSTEM_PROGRAM_PATH, CMAKE_PREFIX_PATH. +:variable:`CMAKE_SYSTEM_PROGRAM_PATH` and :variable:`CMAKE_PREFIX_PATH`. diff --git a/Help/variable/CMAKE_SYSTEM_APPBUNDLE_PATH.rst b/Help/variable/CMAKE_SYSTEM_APPBUNDLE_PATH.rst new file mode 100644 index 0000000..3c6687c --- /dev/null +++ b/Help/variable/CMAKE_SYSTEM_APPBUNDLE_PATH.rst @@ -0,0 +1,7 @@ +CMAKE_SYSTEM_APPBUNDLE_PATH +--------------------------- + +Search path for OS X application bundles used by the :command:`find_program`, +and :command:`find_package` commands. By default it contains the standard +directories for the current system. It is *not* intended to be modified by +the project, use :variable:`CMAKE_APPBUNDLE_PATH` for this. diff --git a/Help/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.rst b/Help/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.rst new file mode 100644 index 0000000..1e8b0d9 --- /dev/null +++ b/Help/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.rst @@ -0,0 +1,8 @@ +CMAKE_SYSTEM_FRAMEWORK_PATH +--------------------------- + +Search path for OS X frameworks used by the :command:`find_library`, +:command:`find_package`, :command:`find_path`, and :command:`find_file` +commands. By default it contains the standard directories for the +current system. It is *not* intended to be modified by the project, +use :variable:`CMAKE_FRAMEWORK_PATH` for this. diff --git a/Help/variable/CMAKE_SYSTEM_IGNORE_PATH.rst b/Help/variable/CMAKE_SYSTEM_IGNORE_PATH.rst index 9e6b195..4ad7e33 100644 --- a/Help/variable/CMAKE_SYSTEM_IGNORE_PATH.rst +++ b/Help/variable/CMAKE_SYSTEM_IGNORE_PATH.rst @@ -1,15 +1,18 @@ CMAKE_SYSTEM_IGNORE_PATH ------------------------ -Path to be ignored by FIND_XXX() commands. +:ref:`;-list <CMake Language Lists>` of directories to be *ignored* by +the :command:`find_program`, :command:`find_library`, :command:`find_file`, +and :command:`find_path` commands. This is useful in cross-compiling +environments where some system directories contain incompatible but +possibly linkable libraries. For example, on cross-compiled cluster +environments, this allows a user to ignore directories containing +libraries meant for the front-end machine. -Specifies directories to be ignored by searches in FIND_XXX() -commands. This is useful in cross-compiled environments where some -system directories contain incompatible but possibly linkable -libraries. For example, on cross-compiled cluster environments, this -allows a user to ignore directories containing libraries meant for the -front-end machine that modules like FindX11 (and others) would -normally search. By default this contains a list of directories -containing incompatible binaries for the host system. See also -CMAKE_SYSTEM_PREFIX_PATH, CMAKE_SYSTEM_LIBRARY_PATH, -CMAKE_SYSTEM_INCLUDE_PATH, and CMAKE_SYSTEM_PROGRAM_PATH. +By default this contains a list of directories containing incompatible +binaries for the host system. See the :variable:`CMAKE_IGNORE_PATH` variable +that is intended to be set by the project. + +See also the :variable:`CMAKE_SYSTEM_PREFIX_PATH`, +:variable:`CMAKE_SYSTEM_LIBRARY_PATH`, :variable:`CMAKE_SYSTEM_INCLUDE_PATH`, +and :variable:`CMAKE_SYSTEM_PROGRAM_PATH` variables. diff --git a/Help/variable/CMAKE_SYSTEM_INCLUDE_PATH.rst b/Help/variable/CMAKE_SYSTEM_INCLUDE_PATH.rst index 1734185..2c14345 100644 --- a/Help/variable/CMAKE_SYSTEM_INCLUDE_PATH.rst +++ b/Help/variable/CMAKE_SYSTEM_INCLUDE_PATH.rst @@ -1,11 +1,8 @@ CMAKE_SYSTEM_INCLUDE_PATH ------------------------- -Path used for searching by FIND_FILE() and FIND_PATH(). - -Specifies a path which will be used both by FIND_FILE() and -FIND_PATH(). Both commands will check each of the contained -directories for the existence of the file which is currently searched. -By default it contains the standard directories for the current -system. It is NOT intended to be modified by the project, use -CMAKE_INCLUDE_PATH for this. See also CMAKE_SYSTEM_PREFIX_PATH. +:ref:`;-list <CMake Language Lists>` of directories specifying a search path +for the :command:`find_file` and :command:`find_path` commands. By default +this contains the standard directories for the current system. It is *not* +intended to be modified by the project; use :variable:`CMAKE_INCLUDE_PATH` for +this. See also :variable:`CMAKE_SYSTEM_PREFIX_PATH`. diff --git a/Help/variable/CMAKE_SYSTEM_LIBRARY_PATH.rst b/Help/variable/CMAKE_SYSTEM_LIBRARY_PATH.rst index 4778646..3969cb9 100644 --- a/Help/variable/CMAKE_SYSTEM_LIBRARY_PATH.rst +++ b/Help/variable/CMAKE_SYSTEM_LIBRARY_PATH.rst @@ -1,11 +1,8 @@ CMAKE_SYSTEM_LIBRARY_PATH ------------------------- -Path used for searching by FIND_LIBRARY(). - -Specifies a path which will be used by FIND_LIBRARY(). FIND_LIBRARY() -will check each of the contained directories for the existence of the -library which is currently searched. By default it contains the -standard directories for the current system. It is NOT intended to be -modified by the project, use CMAKE_LIBRARY_PATH for this. See also -CMAKE_SYSTEM_PREFIX_PATH. +:ref:`;-list <CMake Language Lists>` of directories specifying a search path +for the :command:`find_library` command. By default this contains the +standard directories for the current system. It is *not* intended to be +modified by the project; use :variable:`CMAKE_LIBRARY_PATH` for this. +See also :variable:`CMAKE_SYSTEM_PREFIX_PATH`. diff --git a/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst b/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst index 537eaba..e74dfad 100644 --- a/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst +++ b/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst @@ -1,16 +1,18 @@ CMAKE_SYSTEM_PREFIX_PATH ------------------------ -Path used for searching by FIND_XXX(), with appropriate suffixes added. +:ref:`;-list <CMake Language Lists>` of directories specifying installation +*prefixes* to be searched by the :command:`find_package`, +:command:`find_program`, :command:`find_library`, :command:`find_file`, and +:command:`find_path` commands. Each command will add appropriate +subdirectories (like ``bin``, ``lib``, or ``include``) as specified in its own +documentation. -Specifies a path which will be used by the FIND_XXX() commands. It -contains the "base" directories, the FIND_XXX() commands append -appropriate subdirectories to the base directories. So FIND_PROGRAM() -adds /bin to each of the directories in the path, FIND_LIBRARY() -appends /lib to each of the directories, and FIND_PATH() and -FIND_FILE() append /include . By default this contains the standard -directories for the current system, the CMAKE_INSTALL_PREFIX and -the :variable:`CMAKE_STAGING_PREFIX`. It is NOT intended to be modified by -the project, use CMAKE_PREFIX_PATH for this. See also CMAKE_SYSTEM_INCLUDE_PATH, -CMAKE_SYSTEM_LIBRARY_PATH, CMAKE_SYSTEM_PROGRAM_PATH, and -CMAKE_SYSTEM_IGNORE_PATH. +By default this contains the standard directories for the current system, the +:variable:`CMAKE_INSTALL_PREFIX`, and the :variable:`CMAKE_STAGING_PREFIX`. +It is *not* intended to be modified by the project; use +:variable:`CMAKE_PREFIX_PATH` for this. + +See also :variable:`CMAKE_SYSTEM_INCLUDE_PATH`, +:variable:`CMAKE_SYSTEM_LIBRARY_PATH`, :variable:`CMAKE_SYSTEM_PROGRAM_PATH`, +and :variable:`CMAKE_SYSTEM_IGNORE_PATH`. diff --git a/Help/variable/CMAKE_SYSTEM_PROGRAM_PATH.rst b/Help/variable/CMAKE_SYSTEM_PROGRAM_PATH.rst index e1fad63..cf1b83e 100644 --- a/Help/variable/CMAKE_SYSTEM_PROGRAM_PATH.rst +++ b/Help/variable/CMAKE_SYSTEM_PROGRAM_PATH.rst @@ -1,11 +1,8 @@ CMAKE_SYSTEM_PROGRAM_PATH ------------------------- -Path used for searching by FIND_PROGRAM(). - -Specifies a path which will be used by FIND_PROGRAM(). FIND_PROGRAM() -will check each of the contained directories for the existence of the -program which is currently searched. By default it contains the -standard directories for the current system. It is NOT intended to be -modified by the project, use CMAKE_PROGRAM_PATH for this. See also -CMAKE_SYSTEM_PREFIX_PATH. +:ref:`;-list <CMake Language Lists>` of directories specifying a search path +for the :command:`find_program` command. By default this contains the +standard directories for the current system. It is *not* intended to be +modified by the project; use :variable:`CMAKE_PROGRAM_PATH` for this. +See also :variable:`CMAKE_SYSTEM_PREFIX_PATH`. diff --git a/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst b/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst index af6f08c..06fe0fb 100644 --- a/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst +++ b/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst @@ -1,10 +1,5 @@ CMAKE_USE_RELATIVE_PATHS ------------------------ -Use relative paths (May not work!). - -If this is set to TRUE, then CMake will use relative paths between the -source and binary tree. This option does not work for more -complicated projects, and relative paths are used when possible. In -general, it is not possible to move CMake generated makefiles to a -different location regardless of the value of this variable. +This variable has no effect. The partially implemented effect it +had in previous releases was removed in CMake 3.4. diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 937aa8c..40d4ce6 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -80,6 +80,7 @@ else() # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce # a valid identification file. + set(CMAKE_C_COMPILER_ID_TEST_FLAGS_FIRST) set(CMAKE_C_COMPILER_ID_TEST_FLAGS # Try compiling to an object file only. "-c" diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 893c454..a673525 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -78,6 +78,7 @@ else() # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce # a valid identification file. + set(CMAKE_CXX_COMPILER_ID_TEST_FLAGS_FIRST) set(CMAKE_CXX_COMPILER_ID_TEST_FLAGS # Try compiling to an object file only. "-c" diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 403ac08..68f2194 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -34,12 +34,19 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) # Try building with no extra flags and then try each set # of helper flags. Stop when the compiler is identified. - foreach(flags "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS}) - if(NOT CMAKE_${lang}_COMPILER_ID) - CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}") - foreach(file ${COMPILER_${lang}_PRODUCED_FILES}) - CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}") - endforeach() + foreach(flags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST} + "" + ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS}) + CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}") + CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR("${lang}" "${COMPILER_${lang}_PRODUCED_OUTPUT}") + if(CMAKE_${lang}_COMPILER_ID) + break() + endif() + foreach(file ${COMPILER_${lang}_PRODUCED_FILES}) + CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}") + endforeach() + if(CMAKE_${lang}_COMPILER_ID) + break() endif() endforeach() @@ -355,6 +362,7 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT} # No output files should be inspected. set(COMPILER_${lang}_PRODUCED_FILES) + set(COMPILER_${lang}_PRODUCED_OUTPUT) else() # Compilation succeeded. file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log @@ -395,10 +403,24 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT} "${src}\" did not produce an executable in \"" "${CMAKE_${lang}_COMPILER_ID_DIR}\".\n\n") endif() + + set(COMPILER_${lang}_PRODUCED_OUTPUT "${CMAKE_${lang}_COMPILER_ID_OUTPUT}") endif() # Return the files produced by the compilation. set(COMPILER_${lang}_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE) + set(COMPILER_${lang}_PRODUCED_OUTPUT "${COMPILER_${lang}_PRODUCED_OUTPUT}" PARENT_SCOPE) +endfunction() + +#----------------------------------------------------------------------------- +# Function to extract the compiler id from compiler output. +function(CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR lang output) + foreach(vendor ${CMAKE_${lang}_COMPILER_ID_MATCH_VENDORS}) + if(output MATCHES "${CMAKE_${lang}_COMPILER_ID_MATCH_VENDOR_REGEX_${vendor}}") + set(CMAKE_${lang}_COMPILER_ID "${vendor}") + endif() + endforeach() + set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) endfunction() #----------------------------------------------------------------------------- diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 3a27127..52ec25a 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -98,6 +98,10 @@ else() # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce # a valid identification executable. + set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS_FIRST + # Get verbose output to help distinguish compilers. + "-v" + ) set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS # Try compiling to an object file only. "-c" @@ -111,6 +115,10 @@ endif() if(NOT CMAKE_Fortran_COMPILER_ID_RUN) set(CMAKE_Fortran_COMPILER_ID_RUN 1) + # Table of per-vendor compiler output regular expressions. + list(APPEND CMAKE_Fortran_COMPILER_ID_MATCH_VENDORS CCur) + set(CMAKE_Fortran_COMPILER_ID_MATCH_VENDOR_REGEX_CCur "Concurrent Fortran [0-9]+ Compiler") + # Table of per-vendor compiler id flags with expected output. list(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS Compaq) set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_Compaq "-what") diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 226153c..09cddcd 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -352,10 +352,11 @@ function(cpack_deb_prepare_package_vars) OUTPUT_VARIABLE _TMP_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX MATCH "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)" - SHLIBDEPS_EXECUTABLE_VERSION - "${_TMP_VERSION}") - set(SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}") + if(_TMP_VERSION MATCHES "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)") + set(SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}") + else() + set(SHLIBDEPS_EXECUTABLE_VERSION "") + endif() if(CPACK_DEBIAN_PACKAGE_DEBUG) message("CPackDeb Debug: dpkg-shlibdeps --version output is '${_TMP_VERSION}'") @@ -398,9 +399,12 @@ function(cpack_deb_prepare_package_vars) file(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian) file(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "") - # only set ignore-missing-info flag for dpkg-shlibdeps that have --version option - # (those are newer and also have --ignore-missing-info flag) - if(SHLIBDEPS_EXECUTABLE_VERSION) + # Add --ignore-missing-info if the tool supports it + execute_process(COMMAND env LC_ALL=C ${SHLIBDEPS_EXECUTABLE} --help + OUTPUT_VARIABLE _TMP_HELP + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(_TMP_HELP MATCHES "--ignore-missing-info") set(IGNORE_MISSING_INFO_FLAG "--ignore-missing-info") endif() diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake index 402b37c..ef1e39d 100644 --- a/Modules/CheckIncludeFile.cmake +++ b/Modules/CheckIncludeFile.cmake @@ -2,30 +2,34 @@ # CheckIncludeFile # ---------------- # -# macro which checks the include file exists. +# Provides a macro to check if a header file can be included in ``C``. # -# CHECK_INCLUDE_FILE(INCLUDE VARIABLE) +# .. command:: CHECK_INCLUDE_FILE # -# :: +# :: # -# INCLUDE - name of include file -# VARIABLE - variable to return result -# Will be created as an internal cache variable. +# CHECK_INCLUDE_FILE(<include> <variable> [<flags>]) # -# -# -# an optional third argument is the CFlags to add to the compile line or -# you can use CMAKE_REQUIRED_FLAGS +# Check if the given ``<include>`` file may be included in a ``C`` +# source file and store the result in an internal cache entry named +# ``<variable>``. The optional third argument may be used to add +# compilation flags to the check (or use ``CMAKE_REQUIRED_FLAGS`` below). # # The following variables may be set before calling this macro to modify # the way the check is run: # -# :: +# ``CMAKE_REQUIRED_FLAGS`` +# string of compile command line flags +# ``CMAKE_REQUIRED_DEFINITIONS`` +# list of macros to define (-DFOO=bar) +# ``CMAKE_REQUIRED_INCLUDES`` +# list of include directories +# ``CMAKE_REQUIRED_QUIET`` +# execute quietly without messages # -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# CMAKE_REQUIRED_QUIET = execute quietly without messages +# See the :module:`CheckIncludeFiles` module to check for multiple headers +# at once. See the :module:`CheckIncludeFileCXX` module to check for headers +# using the ``CXX`` language. #============================================================================= # Copyright 2002-2009 Kitware, Inc. diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake index eae1730..9a6df3b 100644 --- a/Modules/CheckIncludeFileCXX.cmake +++ b/Modules/CheckIncludeFileCXX.cmake @@ -2,34 +2,33 @@ # CheckIncludeFileCXX # ------------------- # -# Check if the include file exists. +# Provides a macro to check if a header file can be included in ``CXX``. # -# :: +# .. command:: CHECK_INCLUDE_FILE_CXX # -# CHECK_INCLUDE_FILE_CXX(INCLUDE VARIABLE) +# :: # +# CHECK_INCLUDE_FILE_CXX(<include> <variable> [<flags>]) # -# -# :: -# -# INCLUDE - name of include file -# VARIABLE - variable to return result -# Will be created as an internal cache variable. -# -# -# -# An optional third argument is the CFlags to add to the compile line or -# you can use CMAKE_REQUIRED_FLAGS. +# Check if the given ``<include>`` file may be included in a ``CXX`` +# source file and store the result in an internal cache entry named +# ``<variable>``. The optional third argument may be used to add +# compilation flags to the check (or use ``CMAKE_REQUIRED_FLAGS`` below). # # The following variables may be set before calling this macro to modify # the way the check is run: # -# :: +# ``CMAKE_REQUIRED_FLAGS`` +# string of compile command line flags +# ``CMAKE_REQUIRED_DEFINITIONS`` +# list of macros to define (-DFOO=bar) +# ``CMAKE_REQUIRED_INCLUDES`` +# list of include directories +# ``CMAKE_REQUIRED_QUIET`` +# execute quietly without messages # -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# CMAKE_REQUIRED_QUIET = execute quietly without messages +# See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFiles` +# to check for one or more ``C`` headers. #============================================================================= # Copyright 2002-2009 Kitware, Inc. diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake index 2494862..843cd35 100644 --- a/Modules/CheckIncludeFiles.cmake +++ b/Modules/CheckIncludeFiles.cmake @@ -2,29 +2,34 @@ # CheckIncludeFiles # ----------------- # -# Check if the files can be included +# Provides a macro to check if a list of one or more header files can +# be included together in ``C``. # +# .. command:: CHECK_INCLUDE_FILES # +# :: # -# CHECK_INCLUDE_FILES(INCLUDE VARIABLE) -# -# :: -# -# INCLUDE - list of files to include -# VARIABLE - variable to return result -# Will be created as an internal cache variable. -# +# CHECK_INCLUDE_FILES("<includes>" <variable>) # +# Check if the given ``<includes>`` list may be included together +# in a ``C`` source file and store the result in an internal cache +# entry named ``<variable>``. Specify the ``<includes>`` argument +# as a :ref:`;-list <CMake Language Lists>` of header file names. # # The following variables may be set before calling this macro to modify # the way the check is run: # -# :: +# ``CMAKE_REQUIRED_FLAGS`` +# string of compile command line flags +# ``CMAKE_REQUIRED_DEFINITIONS`` +# list of macros to define (-DFOO=bar) +# ``CMAKE_REQUIRED_INCLUDES`` +# list of include directories +# ``CMAKE_REQUIRED_QUIET`` +# execute quietly without messages # -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# CMAKE_REQUIRED_QUIET = execute quietly without messages +# See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFileCXX` +# to check for a single header file in ``C`` or ``CXX`` languages. #============================================================================= # Copyright 2003-2012 Kitware, Inc. diff --git a/Modules/Compiler/CCur-Fortran.cmake b/Modules/Compiler/CCur-Fortran.cmake new file mode 100644 index 0000000..6ec06ae --- /dev/null +++ b/Modules/Compiler/CCur-Fortran.cmake @@ -0,0 +1 @@ +include(Compiler/GNU-Fortran) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 11a24b8..eee1841 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -529,7 +529,7 @@ if(error_code) endif() execute_process( - COMMAND \"${git_EXECUTABLE}\" submodule init + COMMAND \"${git_EXECUTABLE}\" submodule init ${git_submodules} WORKING_DIRECTORY \"${work_dir}/${src_name}\" RESULT_VARIABLE error_code ) diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index ec3ee78..7d81276 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -2,60 +2,75 @@ # FindBISON # --------- # -# Find bison executable and provides macros to generate custom build rules +# Find ``bison`` executable and provide a macro to generate custom build rules. # # The module defines the following variables: # -# :: +# ``BISON_EXECUTABLE`` +# path to the ``bison`` program # -# BISON_EXECUTABLE - path to the bison program -# BISON_VERSION - version of bison -# BISON_FOUND - true if the program was found +# ``BISON_VERSION`` +# version of ``bison`` # +# ``BISON_FOUND`` +# true if the program was found # +# The minimum required version of ``bison`` can be specified using the +# standard CMake syntax, e.g. ``find_package(BISON 2.1.3)``. # -# The minimum required version of bison can be specified using the -# standard CMake syntax, e.g. find_package(BISON 2.1.3) +# If ``bison`` is found, the module defines the macro:: # -# If bison is found, the module defines the macros: +# BISON_TARGET(<Name> <YaccInput> <CodeOutput> +# [COMPILE_FLAGS <flags>] +# [DEFINES_FILE <file>] +# [VERBOSE <file>] +# ) # -# :: +# which will create a custom rule to generate a parser. ``<YaccInput>`` is +# the path to a yacc file. ``<CodeOutput>`` is the name of the source file +# generated by bison. A header file is also be generated, and contains +# the token list. # -# BISON_TARGET(<Name> <YaccInput> <CodeOutput> [VERBOSE <file>] -# [COMPILE_FLAGS <string>]) +# The options are: # -# which will create a custom rule to generate a parser. <YaccInput> is -# the path to a yacc file. <CodeOutput> is the name of the source file -# generated by bison. A header file is also be generated, and contains -# the token list. If COMPILE_FLAGS option is specified, the next -# parameter is added in the bison command line. if VERBOSE option is -# specified, <file> is created and contains verbose descriptions of the -# grammar and parser. The macro defines a set of variables: +# ``COMPILE_FLAGS <flags>`` +# Specify flags to be added to the ``bison`` command line. +# +# ``DEFINES_FILE <file>`` +# Specify a non-default header ``<file>`` to be generated by ``bison``. +# +# ``VERBOSE <file>`` +# Tell ``bison`` to write verbose descriptions of the grammar and +# parser to the given ``<file>``. # -# :: +# The macro defines the following variables: # -# BISON_${Name}_DEFINED - true is the macro ran successfully -# BISON_${Name}_INPUT - The input source file, an alias for <YaccInput> -# BISON_${Name}_OUTPUT_SOURCE - The source file generated by bison -# BISON_${Name}_OUTPUT_HEADER - The header file generated by bison -# BISON_${Name}_OUTPUTS - The sources files generated by bison -# BISON_${Name}_COMPILE_FLAGS - Options used in the bison command line +# ``BISON_<Name>_DEFINED`` +# true is the macro ran successfully # +# ``BISON_<Name>_INPUT`` +# The input source file, an alias for <YaccInput> # +# ``BISON_<Name>_OUTPUT_SOURCE`` +# The source file generated by bison # -# :: +# ``BISON_<Name>_OUTPUT_HEADER`` +# The header file generated by bison # -# ==================================================================== -# Example: +# ``BISON_<Name>_OUTPUTS`` +# The sources files generated by bison # +# ``BISON_<Name>_COMPILE_FLAGS`` +# Options used in the ``bison`` command line # +# Example usage: # -# :: +# .. code-block:: cmake # -# find_package(BISON) -# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp) -# add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS}) -# ==================================================================== +# find_package(BISON) +# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp +# DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/parser.h) +# add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS}) #============================================================================= # Copyright 2009 Kitware, Inc. @@ -74,6 +89,8 @@ find_program(BISON_EXECUTABLE NAMES bison win_bison DOC "path to the bison executable") mark_as_advanced(BISON_EXECUTABLE) +include(CMakeParseArguments) + if(BISON_EXECUTABLE) # the bison commands should be executed with the C locale, otherwise # the message (which are parsed) may be translated @@ -128,6 +145,12 @@ if(BISON_EXECUTABLE) list(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_extraopts}) endmacro() + # internal macro + macro(BISON_TARGET_option_defines Header) + set(BISON_TARGET_output_header "${Header}") + list(APPEND BISON_TARGET_cmdopt --defines=${BISON_TARGET_output_header}) + endmacro() + #============================================================ # BISON_TARGET (public macro) #============================================================ @@ -136,51 +159,61 @@ if(BISON_EXECUTABLE) set(BISON_TARGET_output_header "") set(BISON_TARGET_cmdopt "") set(BISON_TARGET_outputs "${BisonOutput}") - if(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7) + + # Parsing parameters + set(BISON_TARGET_PARAM_OPTIONS) + set(BISON_TARGET_PARAM_ONE_VALUE_KEYWORDS + VERBOSE + COMPILE_FLAGS + DEFINES_FILE + ) + set(BISON_TARGET_PARAM_MULTI_VALUE_KEYWORDS) + cmake_parse_arguments( + BISON_TARGET_ARG + "${BISON_TARGET_PARAM_OPTIONS}" + "${BISON_TARGET_PARAM_ONE_VALUE_KEYWORDS}" + "${BISON_TARGET_PARAM_MULTI_VALUE_KEYWORDS}" + ${ARGN} + ) + + if(NOT "${BISON_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "") message(SEND_ERROR "Usage") else() - # Parsing parameters - if(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5) - if("${ARGV3}" STREQUAL "VERBOSE") - BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV4}") - endif() - if("${ARGV3}" STREQUAL "COMPILE_FLAGS") - BISON_TARGET_option_extraopts("${ARGV4}") - endif() + if(NOT "${BISON_TARGET_ARG_VERBOSE}" STREQUAL "") + BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${BISON_TARGET_ARG_VERBOSE}") endif() - - if(${ARGC} EQUAL 7) - if("${ARGV5}" STREQUAL "VERBOSE") - BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV6}") - endif() - - if("${ARGV5}" STREQUAL "COMPILE_FLAGS") - BISON_TARGET_option_extraopts("${ARGV6}") - endif() + if(NOT "${BISON_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "") + BISON_TARGET_option_extraopts("${BISON_TARGET_ARG_COMPILE_FLAGS}") + endif() + if(NOT "${BISON_TARGET_ARG_DEFINES_FILE}" STREQUAL "") + BISON_TARGET_option_defines("${BISON_TARGET_ARG_DEFINES_FILE}") endif() - # Header's name generated by bison (see option -d) - list(APPEND BISON_TARGET_cmdopt "-d") - string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}") - string(REPLACE "c" "h" _fileext ${_fileext}) - string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}" - BISON_${Name}_OUTPUT_HEADER "${ARGV2}") - list(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}") + if("${BISON_TARGET_output_header}" STREQUAL "") + # Header's name generated by bison (see option -d) + list(APPEND BISON_TARGET_cmdopt "-d") + string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${BisonOutput}") + string(REPLACE "c" "h" _fileext ${_fileext}) + string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}" + BISON_TARGET_output_header "${BisonOutput}") + endif() + list(APPEND BISON_TARGET_outputs "${BISON_TARGET_output_header}") add_custom_command(OUTPUT ${BISON_TARGET_outputs} ${BISON_TARGET_extraoutputs} COMMAND ${BISON_EXECUTABLE} - ARGS ${BISON_TARGET_cmdopt} -o ${ARGV2} ${ARGV1} - DEPENDS ${ARGV1} + ARGS ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${BisonInput} + DEPENDS ${BisonInput} COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) # define target variables set(BISON_${Name}_DEFINED TRUE) - set(BISON_${Name}_INPUT ${ARGV1}) + set(BISON_${Name}_INPUT ${BisonInput}) set(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs}) set(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt}) set(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}") + set(BISON_${Name}_OUTPUT_HEADER "${BISON_TARGET_output_header}") endif() endmacro() diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index e8e1fb1..f4b0783 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -468,17 +468,31 @@ set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.") if(CMAKE_GENERATOR MATCHES "Visual Studio") set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC") else() - # Using cc which is symlink to clang may let NVCC think it is GCC and issue - # unhandled -dumpspecs option to clang. Also in case neither - # CMAKE_C_COMPILER is defined (project does not use C language) nor - # CUDA_HOST_COMPILER is specified manually we should skip -ccbin and let - # nvcc use its own default C compiler. - if(DEFINED CMAKE_C_COMPILER AND NOT DEFINED CUDA_HOST_COMPILER) - get_filename_component(c_compiler_realpath "${CMAKE_C_COMPILER}" REALPATH) + if(APPLE + AND "${CMAKE_C_COMPILER_ID}" MATCHES "Clang" + AND "${CMAKE_C_COMPILER}" MATCHES "/cc$") + # Using cc which is symlink to clang may let NVCC think it is GCC and issue + # unhandled -dumpspecs option to clang. Also in case neither + # CMAKE_C_COMPILER is defined (project does not use C language) nor + # CUDA_HOST_COMPILER is specified manually we should skip -ccbin and let + # nvcc use its own default C compiler. + # Only care about this on APPLE with clang to avoid + # following symlinks to things like ccache + if(DEFINED CMAKE_C_COMPILER AND NOT DEFINED CUDA_HOST_COMPILER) + get_filename_component(c_compiler_realpath "${CMAKE_C_COMPILER}" REALPATH) + # if the real path does not end up being clang then + # go back to using CMAKE_C_COMPILER + if(NOT "${c_compiler_realpath}" MATCHES "/clang$") + set(c_compiler_realpath "${CMAKE_C_COMPILER}") + endif() + else() + set(c_compiler_realpath "") + endif() + set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC") else() - set(c_compiler_realpath "") + set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}" + CACHE FILEPATH "Host side compiler used by NVCC") endif() - set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC") endif() # Propagate the host flags to the host compiler via -Xcompiler diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake index 8493d80..c88c1b8 100644 --- a/Modules/FindIce.cmake +++ b/Modules/FindIce.cmake @@ -20,7 +20,7 @@ # Ice_SLICE_DIRS - the directories containing the Ice slice interface # definitions # -# Ice programs are reported in:: +# Ice slice programs are reported in:: # # Ice_SLICE2CPP_EXECUTABLE - path to slice2cpp executable # Ice_SLICE2CS_EXECUTABLE - path to slice2cs executable @@ -28,10 +28,49 @@ # Ice_SLICE2FREEZE_EXECUTABLE - path to slice2freeze executable # Ice_SLICE2HTML_EXECUTABLE - path to slice2html executable # Ice_SLICE2JAVA_EXECUTABLE - path to slice2java executable +# Ice_SLICE2JS_EXECUTABLE - path to slice2js executable # Ice_SLICE2PHP_EXECUTABLE - path to slice2php executable # Ice_SLICE2PY_EXECUTABLE - path to slice2py executable # Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable # +# Ice programs are reported in:: +# +# Ice_GLACIER2ROUTER_EXECUTABLE - path to glacier2router executable +# Ice_ICEBOX_EXECUTABLE - path to icebox executable +# Ice_ICEBOXADMIN_EXECUTABLE - path to iceboxadmin executable +# Ice_ICEBOXD_EXECUTABLE - path to iceboxd executable +# Ice_ICEBOXNET_EXECUTABLE - path to iceboxnet executable +# Ice_ICEGRIDADMIN_EXECUTABLE - path to icegridadmin executable +# Ice_ICEGRIDNODE_EXECUTABLE - path to icegridnode executable +# Ice_ICEGRIDNODED_EXECUTABLE - path to icegridnoded executable +# Ice_ICEGRIDREGISTRY_EXECUTABLE - path to icegridregistry executable +# Ice_ICEGRIDREGISTRYD_EXECUTABLE - path to icegridregistryd executable +# Ice_ICEPATCH2CALC_EXECUTABLE - path to icepatch2calc executable +# Ice_ICEPATCH2CLIENT_EXECUTABLE - path to icepatch2client executable +# Ice_ICEPATCH2SERVER_EXECUTABLE - path to icepatch2server executable +# Ice_ICESERVICEINSTALL_EXECUTABLE - path to iceserviceinstall executable +# Ice_ICESTORMADMIN_EXECUTABLE - path to icestormadmin executable +# Ice_ICESTORMMIGRATE_EXECUTABLE - path to icestormmigrate executable +# +# Ice db programs (Windows only; standard system versions on all other +# platforms) are reported in:: +# +# Ice_DB_ARCHIVE_EXECUTABLE - path to db_archive executable +# Ice_DB_CHECKPOINT_EXECUTABLE - path to db_checkpoint executable +# Ice_DB_DEADLOCK_EXECUTABLE - path to db_deadlock executable +# Ice_DB_DUMP_EXECUTABLE - path to db_dump executable +# Ice_DB_HOTBACKUP_EXECUTABLE - path to db_hotbackup executable +# Ice_DB_LOAD_EXECUTABLE - path to db_load executable +# Ice_DB_LOG_VERIFY_EXECUTABLE - path to db_log_verify executable +# Ice_DB_PRINTLOG_EXECUTABLE - path to db_printlog executable +# Ice_DB_RECOVER_EXECUTABLE - path to db_recover executable +# Ice_DB_STAT_EXECUTABLE - path to db_stat executable +# Ice_DB_TUNER_EXECUTABLE - path to db_tuner executable +# Ice_DB_UPGRADE_EXECUTABLE - path to db_upgrade executable +# Ice_DB_VERIFY_EXECUTABLE - path to db_verify executable +# Ice_DUMPDB_EXECUTABLE - path to dumpdb executable +# Ice_TRANSFORMDB_EXECUTABLE - path to transformdb executable +# # Ice component libraries are reported in:: # # Ice_<C>_FOUND - ON if component was found @@ -76,7 +115,7 @@ # Written by Roger Leigh <rleigh@codelibre.net> #============================================================================= -# Copyright 2014 University of Dundee +# Copyright 2014-2015 University of Dundee # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -94,6 +133,8 @@ function(_Ice_FIND) # Released versions of Ice, including generic short forms set(ice_versions 3 + 3.6 + 3.6.0 3.5 3.5.1 3.5.0 @@ -198,19 +239,55 @@ function(_Ice_FIND) endforeach() endif() + set(db_programs + db_archive + db_checkpoint + db_deadlock + db_dump + db_hotbackup + db_load + db_log_verify + db_printlog + db_recover + db_stat + db_tuner + db_upgrade + db_verify + dumpdb + transformdb) + set(ice_programs + glacier2router + icebox + iceboxadmin + iceboxd + iceboxnet + icegridadmin + icegridnode + icegridnoded + icegridregistry + icegridregistryd + icepatch2calc + icepatch2client + icepatch2server + iceserviceinstall + icestormadmin + icestormmigrate) + + set(slice_programs slice2cpp slice2cs slice2freezej slice2freeze slice2html slice2java + slice2js slice2php slice2py slice2rb) # Find all Ice programs - foreach(program ${ice_programs}) + foreach(program ${db_programs} ${ice_programs} ${slice_programs}) string(TOUPPER "${program}" program_upcase) set(cache_var "Ice_${program_upcase}_EXECUTABLE") set(program_var "Ice_${program_upcase}_EXECUTABLE") @@ -373,15 +450,51 @@ if(Ice_DEBUG) message(STATUS "Ice_INCLUDE_DIR directory: ${Ice_INCLUDE_DIR}") message(STATUS "Ice_SLICE_DIR directory: ${Ice_SLICE_DIR}") message(STATUS "Ice_LIBRARIES: ${Ice_LIBRARIES}") + message(STATUS "slice2cpp executable: ${Ice_SLICE2CPP_EXECUTABLE}") message(STATUS "slice2cs executable: ${Ice_SLICE2CS_EXECUTABLE}") message(STATUS "slice2freezej executable: ${Ice_SLICE2FREEZEJ_EXECUTABLE}") message(STATUS "slice2freeze executable: ${Ice_SLICE2FREEZE_EXECUTABLE}") message(STATUS "slice2html executable: ${Ice_SLICE2HTML_EXECUTABLE}") message(STATUS "slice2java executable: ${Ice_SLICE2JAVA_EXECUTABLE}") + message(STATUS "slice2js executable: ${Ice_SLICE2JS_EXECUTABLE}") message(STATUS "slice2php executable: ${Ice_SLICE2PHP_EXECUTABLE}") message(STATUS "slice2py executable: ${Ice_SLICE2PY_EXECUTABLE}") message(STATUS "slice2rb executable: ${Ice_SLICE2RB_EXECUTABLE}") + message(STATUS "glacier2router executable: ${Ice_GLACIER2ROUTER_EXECUTABLE}") + + message(STATUS "icebox executable: ${Ice_ICEBOX_EXECUTABLE}") + message(STATUS "iceboxadmin executable: ${Ice_ICEBOXADMIN_EXECUTABLE}") + message(STATUS "iceboxd executable: ${Ice_ICEBOXD_EXECUTABLE}") + message(STATUS "iceboxnet executable: ${Ice_ICEBOXNET_EXECUTABLE}") + message(STATUS "icegridadmin executable: ${Ice_ICEGRIDADMIN_EXECUTABLE}") + message(STATUS "icegridnode executable: ${Ice_ICEGRIDNODE_EXECUTABLE}") + message(STATUS "icegridnoded executable: ${Ice_ICEGRIDNODED_EXECUTABLE}") + message(STATUS "icegridregistry executable: ${Ice_ICEGRIDREGISTRY_EXECUTABLE}") + message(STATUS "icegridregistryd executable: ${Ice_ICEGRIDREGISTRYD_EXECUTABLE}") + message(STATUS "icepatch2calc executable: ${Ice_ICEPATCH2CALC_EXECUTABLE}") + message(STATUS "icepatch2client executable: ${Ice_ICEPATCH2CLIENT_EXECUTABLE}") + message(STATUS "icepatch2server executable: ${Ice_ICEPATCH2SERVER_EXECUTABLE}") + message(STATUS "iceserviceinstall executable: ${Ice_ICESERVICEINSTALL_EXECUTABLE}") + message(STATUS "icestormadmin executable: ${Ice_ICESTORMADMIN_EXECUTABLE}") + message(STATUS "icestormmigrate executable: ${Ice_ICESTORMMIGRATE_EXECUTABLE}") + + message(STATUS "db_archive executable: ${Ice_DB_ARCHIVE_EXECUTABLE}") + message(STATUS "db_checkpoint executable: ${Ice_DB_CHECKPOINT_EXECUTABLE}") + message(STATUS "db_deadlock executable: ${Ice_DB_DEADLOCK_EXECUTABLE}") + message(STATUS "db_dump executable: ${Ice_DB_DUMP_EXECUTABLE}") + message(STATUS "db_hotbackup executable: ${Ice_DB_HOTBACKUP_EXECUTABLE}") + message(STATUS "db_load executable: ${Ice_DB_LOAD_EXECUTABLE}") + message(STATUS "db_log_verify executable: ${Ice_DB_LOG_VERIFY_EXECUTABLE}") + message(STATUS "db_printlog executable: ${Ice_DB_PRINTLOG_EXECUTABLE}") + message(STATUS "db_recover executable: ${Ice_DB_RECOVER_EXECUTABLE}") + message(STATUS "db_stat executable: ${Ice_DB_STAT_EXECUTABLE}") + message(STATUS "db_tuner executable: ${Ice_DB_TUNER_EXECUTABLE}") + message(STATUS "db_upgrade executable: ${Ice_DB_UPGRADE_EXECUTABLE}") + message(STATUS "db_verify executable: ${Ice_DB_VERIFY_EXECUTABLE}") + message(STATUS "dumpdb executable: ${Ice_DUMPDB_EXECUTABLE}") + message(STATUS "transformdb executable: ${Ice_TRANSFORMDB_EXECUTABLE}") + foreach(component ${Ice_FIND_COMPONENTS}) string(TOUPPER "${component}" component_upcase) set(component_lib "Ice_${component_upcase}_LIBRARIES") diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index c16c011..9a70678 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -740,7 +740,8 @@ else() # UNIX: Start actual work. #----------------------------------------------------------------- # Support cross-compiling, only search in the target platform. - find_program(wxWidgets_CONFIG_EXECUTABLE wx-config wx-config-3.0 + find_program(wxWidgets_CONFIG_EXECUTABLE + NAMES wx-config wx-config-3.0 wx-config-2.9 wx-config-2.8 DOC "Location of wxWidgets library configuration provider binary (wx-config)." ONLY_CMAKE_FIND_ROOT_PATH ) diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index c61e7e9..b42084e 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -4,59 +4,104 @@ # # Define GNU standard installation directories # -# Provides install directory variables as defined for GNU software: +# Provides install directory variables as defined by the +# `GNU Coding Standards`_. # -# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html +# .. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html +# +# Result Variables +# ^^^^^^^^^^^^^^^^ # # Inclusion of this module defines the following variables: # # ``CMAKE_INSTALL_<dir>`` -# destination for files of a given type +# +# Destination for files of a given type. This value may be passed to +# the ``DESTINATION`` options of :command:`install` commands for the +# corresponding file type. +# # ``CMAKE_INSTALL_FULL_<dir>`` -# corresponding absolute path # -# where <dir> is one of: +# The absolute path generated from the corresponding ``CMAKE_INSTALL_<dir>`` +# value. If the value is not already an absolute path, an absolute path +# is constructed typically by prepending the value of the +# :variable:`CMAKE_INSTALL_PREFIX` variable. However, there are some +# `special cases`_ as documented below. +# +# where ``<dir>`` is one of: # # ``BINDIR`` -# user executables (bin) +# user executables (``bin``) # ``SBINDIR`` -# system admin executables (sbin) +# system admin executables (``sbin``) # ``LIBEXECDIR`` -# program executables (libexec) +# program executables (``libexec``) # ``SYSCONFDIR`` -# read-only single-machine data (etc) +# read-only single-machine data (``etc``) # ``SHAREDSTATEDIR`` -# modifiable architecture-independent data (com) +# modifiable architecture-independent data (``com``) # ``LOCALSTATEDIR`` -# modifiable single-machine data (var) +# modifiable single-machine data (``var``) # ``LIBDIR`` -# object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian) +# object code libraries (``lib`` or ``lib64`` +# or ``lib/<multiarch-tuple>`` on Debian) # ``INCLUDEDIR`` -# C header files (include) +# C header files (``include``) # ``OLDINCLUDEDIR`` -# C header files for non-gcc (/usr/include) +# C header files for non-gcc (``/usr/include``) # ``DATAROOTDIR`` -# read-only architecture-independent data root (share) +# read-only architecture-independent data root (``share``) # ``DATADIR`` -# read-only architecture-independent data (DATAROOTDIR) +# read-only architecture-independent data (``DATAROOTDIR``) # ``INFODIR`` -# info documentation (DATAROOTDIR/info) +# info documentation (``DATAROOTDIR/info``) # ``LOCALEDIR`` -# locale-dependent data (DATAROOTDIR/locale) +# locale-dependent data (``DATAROOTDIR/locale``) # ``MANDIR`` -# man documentation (DATAROOTDIR/man) +# man documentation (``DATAROOTDIR/man``) # ``DOCDIR`` -# documentation root (DATAROOTDIR/doc/PROJECT_NAME) +# documentation root (``DATAROOTDIR/doc/PROJECT_NAME``) +# +# If the includer does not define a value the above-shown default will be +# used and the value will appear in the cache for editing by the user. +# +# Special Cases +# ^^^^^^^^^^^^^ +# +# The following values of :variable:`CMAKE_INSTALL_PREFIX` are special: +# +# ``/`` +# +# For ``<dir>`` other than the ``SYSCONFDIR`` and ``LOCALSTATEDIR``, +# the value of ``CMAKE_INSTALL_<dir>`` is prefixed with ``usr/`` if +# it is not user-specified as an absolute path. For example, the +# ``INCLUDEDIR`` value ``include`` becomes ``usr/include``. +# This is required by the `GNU Coding Standards`_, which state: +# +# When building the complete GNU system, the prefix will be empty +# and ``/usr`` will be a symbolic link to ``/``. +# +# ``/usr`` # -# Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION -# options of install() commands for the corresponding file type. If the -# includer does not define a value the above-shown default will be used -# and the value will appear in the cache for editing by the user. Each -# CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed -# from the corresponding destination by prepending (if necessary) the -# value of CMAKE_INSTALL_PREFIX. +# For ``<dir>`` equal to ``SYSCONFDIR`` or ``LOCALSTATEDIR``, the +# ``CMAKE_INSTALL_FULL_<dir>`` is computed by prepending just ``/`` +# to the value of ``CMAKE_INSTALL_<dir>`` if it is not user-specified +# as an absolute path. For example, the ``SYSCONFDIR`` value ``etc`` +# becomes ``/etc``. This is required by the `GNU Coding Standards`_. +# +# ``/opt/...`` +# +# For ``<dir>`` equal to ``SYSCONFDIR`` or ``LOCALSTATEDIR``, the +# ``CMAKE_INSTALL_FULL_<dir>`` is computed by *appending* the prefix +# to the value of ``CMAKE_INSTALL_<dir>`` if it is not user-specified +# as an absolute path. For example, the ``SYSCONFDIR`` value ``etc`` +# becomes ``/etc/opt/...``. This is defined by the +# `Filesystem Hierarchy Standard`_. +# +# .. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html #============================================================================= +# Copyright 2015 Alex Turbov <i.zaufi@gmail.com> # Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com> # Copyright 2011 Kitware, Inc. # @@ -274,8 +319,35 @@ foreach(dir MANDIR DOCDIR ) - if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}}) - set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_${dir}}") + # Handle special cases: + # - CMAKE_INSTALL_PREFIX == / + # - CMAKE_INSTALL_PREFIX == /usr + # - CMAKE_INSTALL_PREFIX == /opt/... + if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/") + if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR") + set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}") + else() + if (NOT "${CMAKE_INSTALL_${dir}}" MATCHES "^usr/") + set(CMAKE_INSTALL_${dir} "usr/${CMAKE_INSTALL_${dir}}") + endif() + set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}") + endif() + elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") + if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR") + set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}") + else() + set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + endif() + elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/.*") + if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR") + set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}${CMAKE_INSTALL_PREFIX}") + else() + set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + endif() + else() + set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + endif() else() set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}") endif() diff --git a/Modules/Platform/Linux-CCur-Fortran.cmake b/Modules/Platform/Linux-CCur-Fortran.cmake new file mode 100644 index 0000000..ceecc2f --- /dev/null +++ b/Modules/Platform/Linux-CCur-Fortran.cmake @@ -0,0 +1 @@ +include(Platform/Linux-GNU-Fortran) diff --git a/Modules/Platform/Linux-GNU-Fortran.cmake b/Modules/Platform/Linux-GNU-Fortran.cmake index 68e9540..85e1226 100644 --- a/Modules/Platform/Linux-GNU-Fortran.cmake +++ b/Modules/Platform/Linux-GNU-Fortran.cmake @@ -1,2 +1,3 @@ include(Platform/Linux-GNU) __linux_compiler_gnu(Fortran) +set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "") diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 26b3c0c..58ef3ca 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -74,6 +74,12 @@ set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +# The Borland link tool does not support multiple concurrent +# invocations within a single working directory. +if(NOT DEFINED CMAKE_JOB_POOL_LINK) + set(CMAKE_JOB_POOL_LINK BCC32LinkPool) + set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1) +endif() macro(__embarcadero_language lang) set(CMAKE_${lang}_COMPILE_OPTIONS_DLL "${_tD}") # Note: This variable is a ';' separated list diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index b571b16..b97409c 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -35,7 +35,7 @@ endif() if(MINGW) set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") - set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib") set(CMAKE_C_STANDARD_LIBRARIES_INIT "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32") set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") endif() diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index a7adb51..6d012fd 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -281,6 +281,7 @@ set(SRCS cmInstallTargetGenerator.cxx cmInstallDirectoryGenerator.h cmInstallDirectoryGenerator.cxx + cmLinkedTree.h cmListFileCache.cxx cmListFileCache.h cmListFileLexer.c @@ -299,6 +300,8 @@ set(SRCS cmMakefileUtilityTargetGenerator.cxx cmOSXBundleGenerator.cxx cmOSXBundleGenerator.h + cmOutputConverter.cxx + cmOutputConverter.h cmNewLineStyle.h cmNewLineStyle.cxx cmOrderDirectories.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4db774f..2570ca3 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 2) -set(CMake_VERSION_PATCH 20150602) +set(CMake_VERSION_MINOR 3) +set(CMake_VERSION_PATCH 20150629) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index d9e4bd4..d108592 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -57,8 +57,7 @@ bool cmCTestRunTest::CheckOutput() // Process has terminated and all output read. return false; } - else if(p == cmsysProcess_Pipe_STDOUT || - p == cmsysProcess_Pipe_STDERR) + else if(p == cmsysProcess_Pipe_STDOUT) { // Store this line of output. cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 1e493b0..047bd98 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -421,6 +421,10 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg.c_str()); } +#if defined(__CYGWIN__) + this->Makefile->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); +#endif + // always add a function blocker to update the elapsed time cmCTestScriptFunctionBlocker *f = new cmCTestScriptFunctionBlocker(); f->CTestScriptHandler = this; diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 8494d28..963e501 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -283,13 +283,13 @@ int cmCTestUpdateHandler::ProcessHandler() { xml.Content("Update command failed:\n"); xml.Content(vc->GetUpdateCommandLine()); - cmCTestLog(this->CTest, ERROR_MESSAGE, " Update command failed: " + cmCTestLog(this->CTest, HANDLER_OUTPUT, " Update command failed: " << vc->GetUpdateCommandLine() << "\n"); } xml.EndElement(); // UpdateReturnStatus xml.EndElement(); // Update xml.EndDocument(); - return numUpdated; + return updated? numUpdated : -1; } //---------------------------------------------------------------------- diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index e1bd02b..0c25f40 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -62,6 +62,7 @@ bool cmProcess::StartProcess() this->WorkingDirectory.c_str()); } cmsysProcess_SetTimeout(this->Process, this->Timeout); + cmsysProcess_SetOption(this->Process, cmsysProcess_Option_MergeOutput, 1); cmsysProcess_Execute(this->Process); return (cmsysProcess_GetState(this->Process) == cmsysProcess_State_Executing); @@ -124,14 +125,10 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout) for(;;) { // Look for lines already buffered. - if(this->StdOut.GetLine(line)) + if(this->Output.GetLine(line)) { return cmsysProcess_Pipe_STDOUT; } - else if(this->StdErr.GetLine(line)) - { - return cmsysProcess_Pipe_STDERR; - } // Check for more data from the process. char* data; @@ -143,11 +140,7 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout) } else if(p == cmsysProcess_Pipe_STDOUT) { - this->StdOut.insert(this->StdOut.end(), data, data+length); - } - else if(p == cmsysProcess_Pipe_STDERR) - { - this->StdErr.insert(this->StdErr.end(), data, data+length); + this->Output.insert(this->Output.end(), data, data+length); } else // p == cmsysProcess_Pipe_None { @@ -157,14 +150,10 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout) } // Look for partial last lines. - if(this->StdOut.GetLast(line)) + if(this->Output.GetLast(line)) { return cmsysProcess_Pipe_STDOUT; } - else if(this->StdErr.GetLast(line)) - { - return cmsysProcess_Pipe_STDERR; - } // No more data. Wait for process exit. if(!cmsysProcess_WaitForExit(this->Process, &timeout)) diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h index 1479df0..eddeeab 100644 --- a/Source/CTest/cmProcess.h +++ b/Source/CTest/cmProcess.h @@ -48,8 +48,7 @@ public: * Read one line of output but block for no more than timeout. * Returns: * cmsysProcess_Pipe_None = Process terminated and all output read - * cmsysProcess_Pipe_STDOUT = Line came from stdout - * cmsysProcess_Pipe_STDOUT = Line came from stderr + * cmsysProcess_Pipe_STDOUT = Line came from stdout or stderr * cmsysProcess_Pipe_Timeout = Timeout expired while waiting */ int GetNextOutputLine(std::string& line, double timeout); @@ -68,13 +67,11 @@ private: bool GetLine(std::string& line); bool GetLast(std::string& line); }; - Buffer StdErr; - Buffer StdOut; + Buffer Output; std::string Command; std::string WorkingDirectory; std::vector<std::string> Arguments; std::vector<const char*> ProcessArgs; - std::string Output; int Id; int ExitValue; }; diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 38d6d44..4f93a77 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -86,7 +86,7 @@ int main(int argc, char** argv) #if defined(Q_OS_MAC) if (argc2 == 2 && strcmp(argv2[1], "--install") == 0) { - return cmOSXInstall("/usr/bin"); + return cmOSXInstall("/usr/local/bin"); } if (argc2 == 2 && cmHasLiteralPrefix(argv2[1], "--install=")) { diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 426fa12..03417f3 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -425,7 +425,7 @@ void CMakeSetupDialog::doInstallForCommandLine() "\n" " PATH=\"%1\":\"$PATH\"\n" "\n" - "Or, to install symlinks to '/usr/bin', run:\n" + "Or, to install symlinks to '/usr/local/bin', run:\n" "\n" " sudo \"%2\" --install\n" "\n" @@ -445,6 +445,7 @@ void CMakeSetupDialog::doInstallForCommandLine() l->addWidget(lab); lab->setText(msg); lab->setWordWrap(false); + lab->setTextInteractionFlags(Qt::TextSelectableByMouse); QDialogButtonBox* btns = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, &dialog); QObject::connect(btns, SIGNAL(accepted()), &dialog, SLOT(accept())); diff --git a/Source/cmCPackPropertiesGenerator.cxx b/Source/cmCPackPropertiesGenerator.cxx index cf24c13..368a0e6 100644 --- a/Source/cmCPackPropertiesGenerator.cxx +++ b/Source/cmCPackPropertiesGenerator.cxx @@ -1,6 +1,6 @@ #include "cmCPackPropertiesGenerator.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" cmCPackPropertiesGenerator::cmCPackPropertiesGenerator( cmMakefile* mf, @@ -29,15 +29,15 @@ void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os, cmInstalledFile::Property const& property = i->second; os << indent << "set_property(INSTALL " << - cmLocalGenerator::EscapeForCMake(expandedFileName) << " PROPERTY " << - cmLocalGenerator::EscapeForCMake(name); + cmOutputConverter::EscapeForCMake(expandedFileName) << " PROPERTY " << + cmOutputConverter::EscapeForCMake(name); for(cmInstalledFile::ExpressionVectorType::const_iterator j = property.ValueExpressions.begin(); j != property.ValueExpressions.end(); ++j) { std::string value = (*j)->Evaluate(this->Makefile, config); - os << " " << cmLocalGenerator::EscapeForCMake(value); + os << " " << cmOutputConverter::EscapeForCMake(value); } os << ")\n"; diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index c55ea35..591a2cd 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -426,8 +426,7 @@ int CCONV cmExecuteCommand(void *arg, const char *name, { // Assume all arguments are quoted. lff.Arguments.push_back( - cmListFileArgument(args[i], cmListFileArgument::Quoted, - "[CMake-Plugin]", 0)); + cmListFileArgument(args[i], cmListFileArgument::Quoted, 0)); } cmExecutionStatus status; return mf->ExecuteCommand(lff,status); @@ -526,11 +525,9 @@ void * CCONV cmCreateSourceFile(void) return (void*)new cmCPluginAPISourceFile; } -void * CCONV cmCreateNewSourceFile(void *arg) +void * CCONV cmCreateNewSourceFile(void *) { - cmMakefile *mf = static_cast<cmMakefile *>(arg); cmCPluginAPISourceFile *sf = new cmCPluginAPISourceFile; - sf->Properties.SetCMakeInstance(mf->GetCMakeInstance()); return (void*)sf; } @@ -630,11 +627,7 @@ const char * CCONV cmSourceFileGetProperty(void *arg,const char *prop) { return sf->FullPath.c_str(); } - bool chain = false; - // Ignore chain because old code will not expect it and it is a - // pain to implement here anyway. - return sf->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE, - chain); + return sf->Properties.GetPropertyValue(prop); } } @@ -662,7 +655,7 @@ void CCONV cmSourceFileSetProperty(void *arg,const char *prop, else if(prop) { if(!value) { value = "NOTFOUND"; } - sf->Properties.SetProperty(prop, value, cmProperty::SOURCE_FILE); + sf->Properties.SetProperty(prop, value); } } @@ -801,8 +794,7 @@ void CCONV cmSourceFileSetName2(void *arg, const char* name, const char* dir, // Implement the old SetName method code here. if(headerFileOnly) { - sf->Properties.SetProperty("HEADER_FILE_ONLY", "1", - cmProperty::SOURCE_FILE); + sf->Properties.SetProperty("HEADER_FILE_ONLY", "1"); } sf->SourceName = name; std::string fname = sf->SourceName; diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 108208e..54209c5 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -161,7 +161,6 @@ bool cmCacheManager::LoadCache(const std::string& path, // Format is key:type=value std::string helpString; CacheEntry e; - e.Properties.SetCMakeInstance(this->CMakeInstance); cmSystemTools::GetLineFromStream(fin, buffer); realbuffer = buffer.c_str(); while(*realbuffer != '0' && @@ -323,7 +322,6 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, { // Create an entry and store the property. CacheEntry& ne = this->Cache[key]; - ne.Properties.SetCMakeInstance(this->CMakeInstance); ne.Type = cmState::UNINITIALIZED; ne.SetProperty(*p, e.Value.c_str()); } @@ -645,7 +643,6 @@ void cmCacheManager::AddCacheEntry(const std::string& key, cmState::CacheEntryType type) { CacheEntry& e = this->Cache[key]; - e.Properties.SetCMakeInstance(this->CMakeInstance); if ( value ) { e.Value = value; @@ -744,9 +741,7 @@ cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const { return this->Value.c_str(); } - bool c = false; - return - this->Properties.GetPropertyValue(prop, cmProperty::CACHE, c); + return this->Properties.GetPropertyValue(prop); } //---------------------------------------------------------------------------- @@ -763,7 +758,7 @@ void cmCacheManager::CacheEntry::SetProperty(const std::string& prop, } else { - this->Properties.SetProperty(prop, value, cmProperty::CACHE); + this->Properties.SetProperty(prop, value); } } @@ -789,7 +784,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop, } else { - this->Properties.AppendProperty(prop, value, cmProperty::CACHE, asString); + this->Properties.AppendProperty(prop, value, asString); } } diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index bd098a5..14e9e56 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -14,7 +14,7 @@ #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmState.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmCommandArgumentLexer.h" @@ -141,8 +141,9 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) { std::ostringstream msg; cmListFileContext lfc; - lfc.FilePath = this->Makefile->GetLocalGenerator() - ->Convert(this->FileName, cmLocalGenerator::HOME); + cmOutputConverter converter(this->Makefile->GetStateSnapshot()); + lfc.FilePath = converter.Convert(this->FileName, + cmOutputConverter::HOME); lfc.Line = this->FileLine; msg << "uninitialized variable \'" << var << "\'"; diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index d375ae6..387afc6 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -80,8 +80,6 @@ private: std::string::size_type InputBufferPos; std::string InputBuffer; std::vector<char> OutputBuffer; - int CurrentLine; - int Verbose; void Print(const char* place, const char* str); void SafePrintMissing(const char* str, int line, int cnt); @@ -94,12 +92,14 @@ private: std::vector<char*> Variables; const cmMakefile* Makefile; std::string Result; + std::string ErrorString; const char* FileName; + long FileLine; + int CurrentLine; + int Verbose; bool WarnUninitialized; bool CheckSystemVars; - long FileLine; bool EscapeQuotes; - std::string ErrorString; bool NoEscapeMode; bool ReplaceAtSyntax; bool RemoveEmpty; diff --git a/Source/cmComputeComponentGraph.h b/Source/cmComputeComponentGraph.h index a2ce946..4dbac4a 100644 --- a/Source/cmComputeComponentGraph.h +++ b/Source/cmComputeComponentGraph.h @@ -67,17 +67,17 @@ private: int Root; int VisitIndex; }; - int TarjanWalkId; std::vector<int> TarjanVisited; std::vector<int> TarjanComponents; std::vector<TarjanEntry> TarjanEntries; + std::vector<NodeList> Components; std::stack<int> TarjanStack; + int TarjanWalkId; int TarjanIndex; void Tarjan(); void TarjanVisit(int i); // Connected components. - std::vector<NodeList> Components; }; #endif diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 09b9d70..51a08c5 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -61,14 +61,7 @@ private: cmMakefile* Makefile; cmGlobalGenerator const* GlobalGenerator; cmake* CMakeInstance; - bool DebugMode; - - // Configuration information. - bool HasConfig; std::string Config; - cmTarget::LinkLibraryType LinkType; - - // Output information. EntryVector FinalLinkEntries; typedef cmTarget::LinkLibraryVectorType LinkLibraryVectorType; @@ -131,7 +124,7 @@ private: void OrderLinkEntires(); std::vector<char> ComponentVisited; std::vector<int> ComponentOrder; - int ComponentOrderId; + struct PendingComponent { // The real component id. Needed because the map is indexed by @@ -158,11 +151,14 @@ private: // Record of the original link line. std::vector<int> OriginalEntries; + std::set<cmTarget const*> OldWrongConfigItems; + void CheckWrongConfigItem(cmLinkItem const& item); - // Compatibility help. + int ComponentOrderId; + cmTarget::LinkLibraryType LinkType; + bool HasConfig; + bool DebugMode; bool OldLinkDirMode; - void CheckWrongConfigItem(cmLinkItem const& item); - std::set<cmTarget const*> OldWrongConfigItems; }; #endif diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index e6cbe60..1f3046a 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -16,7 +16,7 @@ #include "cmGlobalGenerator.h" #include "cmState.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmMakefile.h" #include "cmTarget.h" #include "cmake.h" @@ -246,7 +246,6 @@ cmComputeLinkInformation // Store context information. this->Target = target; this->Makefile = this->Target->GetMakefile(); - this->LocalGenerator = this->Makefile->GetLocalGenerator(); this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); @@ -1395,7 +1394,8 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item) // Add the item using the -framework option. this->Items.push_back(Item("-framework", false)); - fw = this->LocalGenerator->EscapeForShell(fw); + cmOutputConverter converter(this->Makefile->GetStateSnapshot()); + fw = converter.EscapeForShell(fw); this->Items.push_back(Item(fw, false)); } diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 8847141..3afbb92 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -18,7 +18,6 @@ class cmake; class cmGlobalGenerator; -class cmLocalGenerator; class cmMakefile; class cmTarget; class cmOrderDirectories; @@ -75,14 +74,12 @@ private: // Context information. cmTarget const* Target; cmMakefile* Makefile; - cmLocalGenerator* LocalGenerator; cmGlobalGenerator* GlobalGenerator; cmake* CMakeInstance; // Configuration information. std::string Config; std::string LinkLanguage; - bool LinkDependsNoShared; // Modes for dealing with dependent shared libraries. enum SharedDepMode @@ -93,8 +90,6 @@ private: SharedDepModeLink // List file on link line }; - // System info. - bool UseImportLibrary; const char* LoaderFlag; std::string LibLinkFlag; std::string LibLinkFileFlag; @@ -102,22 +97,18 @@ private: std::string RuntimeFlag; std::string RuntimeSep; std::string RuntimeAlways; - bool RuntimeUseChrpath; - bool NoSONameUsesPath; - bool LinkWithRuntimePath; std::string RPathLinkFlag; SharedDepMode SharedDependencyMode; + enum LinkType { LinkUnknown, LinkStatic, LinkShared }; + void SetCurrentLinkType(LinkType lt); + // Link type adjustment. void ComputeLinkTypeInfo(); - enum LinkType { LinkUnknown, LinkStatic, LinkShared }; LinkType StartLinkType; LinkType CurrentLinkType; std::string StaticLinkTypeFlag; std::string SharedLinkTypeFlag; - bool LinkTypeEnabled; - void SetCurrentLinkType(LinkType lt); - bool ArchivesMayBeShared; // Link item parsing. void ComputeItemParserInfo(); @@ -129,7 +120,6 @@ private: cmsys::RegularExpression ExtractSharedLibraryName; cmsys::RegularExpression ExtractAnyLibraryName; std::string SharedRegexString; - bool OpenBSD; void AddLinkPrefix(const char* p); void AddLinkExtension(const char* e, LinkType type); std::string CreateExtensionRegex(std::vector<std::string> const& exts, @@ -173,20 +163,27 @@ private: std::set<std::string> OldLinkDirMask; std::vector<std::string> OldLinkDirItems; std::vector<std::string> OldUserFlagItems; - bool OldLinkDirMode; - - // CMP0060 warnings. - bool CMP0060Warn; std::set<std::string> CMP0060WarnItems; - + // Dependent library path computation. + cmOrderDirectories* OrderDependentRPath; // Runtime path computation. cmOrderDirectories* OrderRuntimeSearchPath; + + bool OldLinkDirMode; + bool OpenBSD; + bool LinkDependsNoShared; + bool UseImportLibrary; + bool RuntimeUseChrpath; + bool NoSONameUsesPath; + bool LinkWithRuntimePath; + bool LinkTypeEnabled; + bool ArchivesMayBeShared; + bool CMP0060Warn; + void AddLibraryRuntimeInfo(std::string const& fullPath, cmTarget const* target); void AddLibraryRuntimeInfo(std::string const& fullPath); - // Dependent library path computation. - cmOrderDirectories* OrderDependentRPath; }; #endif diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index dd276a8..e1e1a5c 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -11,7 +11,7 @@ ============================================================================*/ #include "cmCoreTryCompile.h" #include "cmake.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmGlobalGenerator.h" #include "cmAlgorithms.h" #include "cmExportTryCompileFileGenerator.h" @@ -322,7 +322,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) std::string langFlags = "CMAKE_" + *li + "_FLAGS"; const char* flags = this->Makefile->GetDefinition(langFlags); fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li->c_str(), - cmLocalGenerator::EscapeForCMake(flags?flags:"").c_str()); + cmOutputConverter::EscapeForCMake(flags?flags:"").c_str()); fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}" " ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str()); } @@ -355,7 +355,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) const char* exeLinkFlags = this->Makefile->GetDefinition("CMAKE_EXE_LINKER_FLAGS"); fprintf(fout, "set(CMAKE_EXE_LINKER_FLAGS %s)\n", - cmLocalGenerator::EscapeForCMake( + cmOutputConverter::EscapeForCMake( exeLinkFlags ? exeLinkFlags : "").c_str()); } break; } diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index 015825d..7c37e3b 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -17,7 +17,7 @@ //---------------------------------------------------------------------------- cmCustomCommand::cmCustomCommand() - : Backtrace(NULL) + : Backtrace() { this->HaveComment = false; this->EscapeOldStyle = true; @@ -26,46 +26,6 @@ cmCustomCommand::cmCustomCommand() } //---------------------------------------------------------------------------- -cmCustomCommand::cmCustomCommand(const cmCustomCommand& r): - Outputs(r.Outputs), - Byproducts(r.Byproducts), - Depends(r.Depends), - CommandLines(r.CommandLines), - HaveComment(r.HaveComment), - Comment(r.Comment), - WorkingDirectory(r.WorkingDirectory), - EscapeAllowMakeVars(r.EscapeAllowMakeVars), - EscapeOldStyle(r.EscapeOldStyle), - Backtrace(r.Backtrace), - UsesTerminal(r.UsesTerminal) -{ -} - -//---------------------------------------------------------------------------- -cmCustomCommand& cmCustomCommand::operator=(cmCustomCommand const& r) -{ - if(this == &r) - { - return *this; - } - - this->Outputs = r.Outputs; - this->Byproducts= r.Byproducts; - this->Depends = r.Depends; - this->CommandLines = r.CommandLines; - this->HaveComment = r.HaveComment; - this->Comment = r.Comment; - this->WorkingDirectory = r.WorkingDirectory; - this->EscapeAllowMakeVars = r.EscapeAllowMakeVars; - this->EscapeOldStyle = r.EscapeOldStyle; - this->ImplicitDepends = r.ImplicitDepends; - this->Backtrace = r.Backtrace; - this->UsesTerminal = r.UsesTerminal; - - return *this; -} - -//---------------------------------------------------------------------------- cmCustomCommand::cmCustomCommand(cmMakefile const* mf, const std::vector<std::string>& outputs, const std::vector<std::string>& byproducts, @@ -77,15 +37,13 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf, Byproducts(byproducts), Depends(depends), CommandLines(commandLines), - HaveComment(comment?true:false), + Backtrace(), Comment(comment?comment:""), WorkingDirectory(workingDirectory?workingDirectory:""), + HaveComment(comment?true:false), EscapeAllowMakeVars(false), - EscapeOldStyle(true), - Backtrace(NULL) + EscapeOldStyle(true) { - this->EscapeOldStyle = true; - this->EscapeAllowMakeVars = false; if(mf) { this->Backtrace = mf->GetBacktrace(); @@ -93,11 +51,6 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf, } //---------------------------------------------------------------------------- -cmCustomCommand::~cmCustomCommand() -{ -} - -//---------------------------------------------------------------------------- const std::vector<std::string>& cmCustomCommand::GetOutputs() const { return this->Outputs; diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index 0bfaef2..f9b38c3 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -26,8 +26,6 @@ class cmCustomCommand public: /** Default and copy constructors for STL containers. */ cmCustomCommand(); - cmCustomCommand(const cmCustomCommand& r); - cmCustomCommand& operator=(cmCustomCommand const& r); /** Main constructor specifies all information for the command. */ cmCustomCommand(cmMakefile const* mf, @@ -38,8 +36,6 @@ public: const char* comment, const char* workingDirectory); - ~cmCustomCommand(); - /** Get the output file produced by the command. */ const std::vector<std::string>& GetOutputs() const; @@ -93,13 +89,13 @@ private: std::vector<std::string> Byproducts; std::vector<std::string> Depends; cmCustomCommandLines CommandLines; - bool HaveComment; + cmListFileBacktrace Backtrace; + ImplicitDependsList ImplicitDepends; std::string Comment; std::string WorkingDirectory; + bool HaveComment; bool EscapeAllowMakeVars; bool EscapeOldStyle; - cmListFileBacktrace Backtrace; - ImplicitDependsList ImplicitDepends; bool UsesTerminal; }; diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index d23f815..11308c6 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -13,13 +13,13 @@ #include "cmMakefile.h" #include "cmCustomCommand.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmGeneratorExpression.h" //---------------------------------------------------------------------------- cmCustomCommandGenerator::cmCustomCommandGenerator( cmCustomCommand const& cc, const std::string& config, cmMakefile* mf): - CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()), + CC(cc), Config(config), Makefile(mf), OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), GE(new cmGeneratorExpression(&cc.GetBacktrace())), DependsDone(false) { @@ -96,7 +96,8 @@ cmCustomCommandGenerator } else { - cmd += this->LG->EscapeForShell(arg, this->MakeVars); + cmOutputConverter converter(this->Makefile->GetStateSnapshot()); + cmd += converter.EscapeForShell(arg, this->MakeVars); } } } diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index b4ae014..7ad95d1 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -16,7 +16,6 @@ class cmCustomCommand; class cmMakefile; -class cmLocalGenerator; class cmGeneratorExpression; class cmCustomCommandGenerator @@ -24,7 +23,6 @@ class cmCustomCommandGenerator cmCustomCommand const& CC; std::string Config; cmMakefile* Makefile; - cmLocalGenerator* LG; bool OldStyle; bool MakeVars; cmGeneratorExpression* GE; diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 8854c36..b6c5fde 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -13,7 +13,6 @@ #define _cmDocumentation_h #include "cmStandardIncludes.h" -#include "cmProperty.h" #include "cmDocumentationFormatter.h" #include "cmDocumentationSection.h" #include "cmake.h" diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx index e021d0b..41785c2 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -156,7 +156,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, verbose = false; } -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) // if the command does not start with a quote, then // try to find the program, and if the program can not be // found use system to run the command as it must be a built in @@ -219,7 +219,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, return false; } -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) if(dir) { cmsysProcess_SetWorkingDirectory(cp, dir); @@ -305,7 +305,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, } if(!msg.empty()) { -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) // Old Windows process execution printed this info. msg += "\n\nfor command: "; msg += command; diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index bf18deb..568ce89 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -18,7 +18,7 @@ //---------------------------------------------------------------------------- cmExportBuildFileGenerator::cmExportBuildFileGenerator() - : Backtrace(NULL) + : Backtrace() { this->Makefile = 0; this->ExportSet = 0; diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index a51fb2a..094ad4f 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -23,12 +23,28 @@ #include "cmVersion.h" #include "cmComputeLinkInformation.h" #include "cmAlgorithms.h" +#include "cmOutputConverter.h" #include <cmsys/auto_ptr.hxx> #include <cmsys/FStream.hxx> #include <assert.h> //---------------------------------------------------------------------------- +static std::string cmExportFileGeneratorEscape(std::string const& str) +{ + // Escape a property value for writing into a .cmake file. + std::string result = cmOutputConverter::EscapeForCMake(str); + // Un-escape variable references generated by our own export code. + cmSystemTools::ReplaceString(result, + "\\${_IMPORT_PREFIX}", + "${_IMPORT_PREFIX}"); + cmSystemTools::ReplaceString(result, + "\\${CMAKE_IMPORT_LIBRARY_SUFFIX}", + "${CMAKE_IMPORT_LIBRARY_SUFFIX}"); + return result; +} + +//---------------------------------------------------------------------------- cmExportFileGenerator::cmExportFileGenerator() { this->AppendMode = false; @@ -608,7 +624,8 @@ void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget const* target, for(ImportPropertyMap::const_iterator pi = properties.begin(); pi != properties.end(); ++pi) { - os << " " << pi->first << " \"" << pi->second << "\"\n"; + os << " " << pi->first << " " + << cmExportFileGeneratorEscape(pi->second) << "\n"; } os << ")\n\n"; } @@ -1112,7 +1129,8 @@ cmExportFileGenerator for(ImportPropertyMap::const_iterator pi = properties.begin(); pi != properties.end(); ++pi) { - os << " " << pi->first << " \"" << pi->second << "\"\n"; + os << " " << pi->first << " " + << cmExportFileGeneratorEscape(pi->second) << "\n"; } os << " )\n" << "\n"; @@ -1223,7 +1241,7 @@ cmExportFileGenerator ImportPropertyMap::const_iterator pi = properties.find(*li); if (pi != properties.end()) { - os << "\"" << pi->second << "\" "; + os << cmExportFileGeneratorEscape(pi->second) << " "; } } diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index eb8d193..dfb991b 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -99,8 +99,6 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target, || i->first.find("IMPORTED_LINK_DEPENDENT_LIBRARIES") == 0 || i->first.find("INTERFACE_LINK_LIBRARIES") == 0) { - const std::string libs = i->second.GetValue(); - std::string evalResult = this->FindTargets(i->first, target, emitted); @@ -118,6 +116,7 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target, } } } + std::string cmExportTryCompileFileGenerator::InstallNameDir(cmTarget* target, const std::string& config) diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index e374387..a31e832 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -313,7 +313,7 @@ void cmExtraCodeBlocksGenerator " "<<virtualFolders<<"\n" " <Build>\n"; - this->AppendTarget(fout, "all", 0, make.c_str(), mf, compiler.c_str()); + this->AppendTarget(fout, "all", 0, make.c_str(), lgs[0], compiler.c_str()); // add all executable and library targets and some of the GLOBAL // and UTILITY targets @@ -335,7 +335,7 @@ void cmExtraCodeBlocksGenerator makefile->GetHomeOutputDirectory())==0) { this->AppendTarget(fout, ti->first, 0, - make.c_str(), makefile, compiler.c_str()); + make.c_str(), *lg, compiler.c_str()); } } break; @@ -351,7 +351,7 @@ void cmExtraCodeBlocksGenerator } this->AppendTarget(fout, ti->first, 0, - make.c_str(), makefile, compiler.c_str()); + make.c_str(), *lg, compiler.c_str()); break; case cmTarget::EXECUTABLE: case cmTarget::STATIC_LIBRARY: @@ -360,11 +360,11 @@ void cmExtraCodeBlocksGenerator case cmTarget::OBJECT_LIBRARY: { this->AppendTarget(fout, ti->first, &ti->second, - make.c_str(), makefile, compiler.c_str()); + make.c_str(), *lg, compiler.c_str()); std::string fastTarget = ti->first; fastTarget += "/fast"; this->AppendTarget(fout, fastTarget, &ti->second, - make.c_str(), makefile, compiler.c_str()); + make.c_str(), *lg, compiler.c_str()); } break; default: @@ -519,14 +519,16 @@ void cmExtraCodeBlocksGenerator // Write a dummy file for OBJECT libraries, so C::B can reference some file std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile( - cmMakefile* mf, cmTarget* target) const + cmLocalGenerator* lg, + cmTarget* target) const { + cmMakefile *mf = lg->GetMakefile(); // this file doesn't seem to be used by C::B in custom makefile mode, // but we generate a unique file for each OBJECT library so in case // C::B uses it in some way, the targets don't interfere with each other. std::string filename = mf->GetCurrentBinaryDirectory(); filename += "/"; - filename += mf->GetLocalGenerator()->GetTargetDirectory(*target); + filename += lg->GetTargetDirectory(*target); filename += "/"; filename += target->GetName(); filename += ".objlib"; @@ -547,9 +549,10 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, const std::string& targetName, cmTarget* target, const char* make, - const cmMakefile* makefile, + const cmLocalGenerator* lg, const char* compiler) { + cmMakefile const* makefile = lg->GetMakefile(); std::string makefileName = makefile->GetCurrentBinaryDirectory(); makefileName += "/Makefile"; @@ -583,7 +586,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, std::string location; if ( target->GetType()==cmTarget::OBJECT_LIBRARY) { - location = this->CreateDummyTargetFile(const_cast<cmMakefile*>(makefile), + location = this->CreateDummyTargetFile(const_cast<cmLocalGenerator*>(lg), target); } else @@ -618,8 +621,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, std::set<std::string> uniqIncludeDirs; std::vector<std::string> includes; - target->GetMakefile()->GetLocalGenerator()-> - GetIncludeDirectories(includes, gtgt, "C", buildType); + lg->GetIncludeDirectories(includes, gtgt, "C", buildType); uniqIncludeDirs.insert(includes.begin(), includes.end()); diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h index 97da1b8..e5ede9a 100644 --- a/Source/cmExtraCodeBlocksGenerator.h +++ b/Source/cmExtraCodeBlocksGenerator.h @@ -48,7 +48,8 @@ private: void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs, const std::string& filename); - std::string CreateDummyTargetFile(cmMakefile* mf, cmTarget* target) const; + std::string CreateDummyTargetFile(cmLocalGenerator* lg, + cmTarget* target) const; std::string GetCBCompilerId(const cmMakefile* mf); int GetCBTargetType(cmTarget* target); @@ -58,7 +59,7 @@ private: const std::string& targetName, cmTarget* target, const char* make, - const cmMakefile* makefile, + const cmLocalGenerator* lg, const char* compiler); }; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 4698468..f740020 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -66,7 +66,7 @@ static mode_t mode_setuid = S_ISUID; static mode_t mode_setgid = S_ISGID; #endif -#if defined(WIN32) && defined(CMAKE_ENCODING_UTF8) +#if defined(_WIN32) && defined(CMAKE_ENCODING_UTF8) // libcurl doesn't support file:// urls for unicode filenames on Windows. // Convert string from UTF-8 to ACP if this is a file:// URL. static std::string fix_file_url_windows(const std::string& url) @@ -906,13 +906,13 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args, { switch(status) { + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: g.RecurseThroughSymlinksOff(); break; case cmPolicies::OLD: case cmPolicies::WARN: - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: g.RecurseThroughSymlinksOn(); break; } @@ -1044,6 +1044,8 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args, { switch (status) { + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: // Correct behavior, yay! break; @@ -1059,12 +1061,6 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args, cmPolicies::GetPolicyWarning(cmPolicies::CMP0009)); } break; - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - this->SetError("policy CMP0009 error"); - this->Makefile->IssueMessage(cmake::FATAL_ERROR, - cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0009)); - return false; } } @@ -3160,7 +3156,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) return false; } -#if defined(WIN32) && defined(CMAKE_ENCODING_UTF8) +#if defined(_WIN32) && defined(CMAKE_ENCODING_UTF8) url = fix_file_url_windows(url); #endif @@ -3415,7 +3411,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) unsigned long file_size = cmsys::SystemTools::FileLength(filename); -#if defined(WIN32) && defined(CMAKE_ENCODING_UTF8) +#if defined(_WIN32) && defined(CMAKE_ENCODING_UTF8) url = fix_file_url_windows(url); #endif diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index 0dcda4d..e983bfb 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -13,6 +13,17 @@ #include <cmsys/auto_ptr.hxx> +cmForEachFunctionBlocker::cmForEachFunctionBlocker(cmMakefile* mf): + Makefile(mf), Depth(0) +{ + this->Makefile->PushLoopBlock(); +} + +cmForEachFunctionBlocker::~cmForEachFunctionBlocker() +{ + this->Makefile->PopLoopBlock(); +} + bool cmForEachFunctionBlocker:: IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmExecutionStatus &inStatus) @@ -27,8 +38,6 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, // if this is the endofreach for this statement if (!this->Depth) { - cmMakefile::LoopBlockPop loopBlockPop(&mf); - // Remove the function blocker for this scope or bail. cmsys::auto_ptr<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(this, lff)); @@ -128,7 +137,7 @@ bool cmForEachCommand } // create a function blocker - cmForEachFunctionBlocker *f = new cmForEachFunctionBlocker(); + cmForEachFunctionBlocker *f = new cmForEachFunctionBlocker(this->Makefile); if ( args.size() > 1 ) { if ( args[1] == "RANGE" ) @@ -204,15 +213,14 @@ bool cmForEachCommand } this->Makefile->AddFunctionBlocker(f); - this->Makefile->PushLoopBlock(); - return true; } //---------------------------------------------------------------------------- bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args) { - cmsys::auto_ptr<cmForEachFunctionBlocker> f(new cmForEachFunctionBlocker()); + cmsys::auto_ptr<cmForEachFunctionBlocker> + f(new cmForEachFunctionBlocker(this->Makefile)); f->Args.push_back(args[0]); enum Doing { DoingNone, DoingLists, DoingItems }; @@ -250,7 +258,5 @@ bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args) this->Makefile->AddFunctionBlocker(f.release()); // TODO: pass auto_ptr - this->Makefile->PushLoopBlock(); - return true; } diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h index 9b7c85a..36e8808 100644 --- a/Source/cmForEachCommand.h +++ b/Source/cmForEachCommand.h @@ -19,8 +19,8 @@ class cmForEachFunctionBlocker : public cmFunctionBlocker { public: - cmForEachFunctionBlocker() {this->Depth = 0;} - virtual ~cmForEachFunctionBlocker() {} + cmForEachFunctionBlocker(cmMakefile* mf); + ~cmForEachFunctionBlocker(); virtual bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmExecutionStatus &); @@ -29,6 +29,7 @@ public: std::vector<std::string> Args; std::vector<cmListFileFunction> Functions; private: + cmMakefile* Makefile; int Depth; }; diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 001adb1..b3576c3 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -43,6 +43,7 @@ public: newC->Args = this->Args; newC->Functions = this->Functions; newC->Policies = this->Policies; + newC->FilePath = this->FilePath; return newC; } @@ -71,9 +72,9 @@ public: std::vector<std::string> Args; std::vector<cmListFileFunction> Functions; cmPolicies::PolicyMap Policies; + std::string FilePath; }; - bool cmFunctionHelperCommand::InvokeInitialPass (const std::vector<cmListFileArgument>& args, cmExecutionStatus & inStatus) @@ -93,14 +94,8 @@ bool cmFunctionHelperCommand::InvokeInitialPass return false; } - // we push a scope on the makefile - cmMakefile::ScopePushPop varScope(this->Makefile); - cmMakefile::LexicalPushPop lexScope(this->Makefile); - static_cast<void>(varScope); - - // Push a weak policy scope which restores the policies recorded at - // function creation. - cmMakefile::PolicyPushPop polScope(this->Makefile, true, this->Policies); + cmMakefile::FunctionPushPop functionScope(this->Makefile, + this->Policies); // set the value of argc std::ostringstream strStream; @@ -145,8 +140,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass { // The error message should have already included the call stack // so we do not need to report an error here. - lexScope.Quiet(); - polScope.Quiet(); + functionScope.Quiet(); inStatus.SetNestedError(true); return false; } @@ -179,19 +173,9 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmFunctionHelperCommand *f = new cmFunctionHelperCommand(); f->Args = this->Args; f->Functions = this->Functions; + f->FilePath = this->GetStartingContext().FilePath; mf.RecordPolicies(f->Policies); - // Set the FilePath on the arguments to match the function since it is - // not stored and the original values may be freed - for (unsigned int i = 0; i < f->Functions.size(); ++i) - { - for (unsigned int j = 0; j < f->Functions[i].Arguments.size(); ++j) - { - f->Functions[i].Arguments[j].FilePath = - f->Functions[i].FilePath.c_str(); - } - } - std::string newName = "_" + this->Args[0]; mf.GetState()->RenameCommand(this->Args[0], newName); mf.GetState()->AddCommand(f); @@ -220,7 +204,8 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf) if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endfunction")) { std::vector<std::string> expandedArguments; - mf.ExpandArguments(lff.Arguments, expandedArguments); + mf.ExpandArguments(lff.Arguments, expandedArguments, + this->GetStartingContext().FilePath.c_str()); // if the endfunction has arguments then make sure // they match the ones in the opening function command if ((expandedArguments.empty() || diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index a1c405b..3655a87 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -34,7 +34,7 @@ cmGeneratorExpression::Parse(std::string const& input) { return cmsys::auto_ptr<cmCompiledGeneratorExpression>( new cmCompiledGeneratorExpression( - this->Backtrace ? *this->Backtrace : cmListFileBacktrace(NULL), + this->Backtrace ? *this->Backtrace : cmListFileBacktrace(), input)); } diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index ff8790c..851aacd 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -35,7 +35,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( const GeneratorExpressionContent *content, cmGeneratorExpressionDAGChecker *parent) : Parent(parent), Target(target), Property(property), - Content(content), Backtrace(NULL), TransitivePropertiesOnly(false) + Content(content), Backtrace(), TransitivePropertiesOnly(false) { Initialize(); } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e2b8c45..4494553 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -220,14 +220,20 @@ struct TagVisitor }; //---------------------------------------------------------------------------- -cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t), +cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) + : Target(t), SourceFileFlagsConstructed(false) { this->Makefile = this->Target->GetMakefile(); - this->LocalGenerator = this->Makefile->GetLocalGenerator(); + this->LocalGenerator = lg; this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); } +cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const +{ + return this->LocalGenerator; +} + //---------------------------------------------------------------------------- int cmGeneratorTarget::GetType() const { @@ -353,6 +359,34 @@ void cmGeneratorTarget::ComputeObjectMapping() } //---------------------------------------------------------------------------- +const char* cmGeneratorTarget::GetFeature(const std::string& feature, + const std::string& config) const +{ + if(!config.empty()) + { + std::string featureConfig = feature; + featureConfig += "_"; + featureConfig += cmSystemTools::UpperCase(config); + if(const char* value = this->Target->GetProperty(featureConfig)) + { + return value; + } + } + if(const char* value = this->Target->GetProperty(feature)) + { + return value; + } + return this->LocalGenerator->GetFeature(feature, config); +} + +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::GetFeatureAsBool(const std::string& feature, + const std::string& config) const +{ + return cmSystemTools::IsOn(this->GetFeature(feature, config)); +} + +//---------------------------------------------------------------------------- const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file) { this->ComputeObjectMapping(); @@ -677,7 +711,8 @@ cmTargetTraceDependencies e << "Evaluation output file\n \"" << sf->GetFullPath() << "\"\ndepends on the sources of a target it is used in. This " "is a dependency loop and is not allowed."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->GeneratorTarget + ->LocalGenerator->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } if(emitted.insert(sf).second && this->SourcesQueued.insert(sf).second) @@ -983,7 +1018,7 @@ cmGeneratorTarget::GetCreateRuleVariable(std::string const& lang, case cmTarget::STATIC_LIBRARY: { std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY"; - if(this->Target->GetFeatureAsBool( + if(this->GetFeatureAsBool( "INTERPROCEDURAL_OPTIMIZATION", config)) { std::string varIPO = var + "_IPO"; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index c79aa72..675ee9f 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -24,7 +24,9 @@ class cmTarget; class cmGeneratorTarget { public: - cmGeneratorTarget(cmTarget*); + cmGeneratorTarget(cmTarget*, cmLocalGenerator* lg); + + cmLocalGenerator* GetLocalGenerator() const; int GetType() const; std::string GetName() const; @@ -67,6 +69,11 @@ public: void ComputeObjectMapping(); + const char* GetFeature(const std::string& feature, + const std::string& config) const; + bool GetFeatureAsBool(const std::string& feature, + const std::string& config) const; + cmTarget* Target; cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index 76803c1..a460ca6 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -32,8 +32,7 @@ bool cmGetCMakePropertyCommand if ( args[1] == "VARIABLES" ) { - int cacheonly = 0; - std::vector<std::string> vars = this->Makefile->GetDefinitions(cacheonly); + std::vector<std::string> vars = this->Makefile->GetDefinitions(); if (!vars.empty()) { output = cmJoin(vars, ";"); @@ -52,9 +51,11 @@ bool cmGetCMakePropertyCommand } else { - const char *prop = - this->Makefile->GetState() - ->GetGlobalProperty(args[1]); + const char *prop = 0; + if (!args[1].empty()) + { + prop = this->Makefile->GetState()->GetGlobalProperty(args[1]); + } if (prop) { output = prop; diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index 4fe3318..c056d95 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -26,7 +26,6 @@ bool cmGetDirectoryPropertyCommand std::vector<std::string>::const_iterator i = args.begin(); std::string variable = *i; ++i; - std::string output = ""; // get the directory argument if there is one cmMakefile *dir = this->Makefile; @@ -79,18 +78,45 @@ bool cmGetDirectoryPropertyCommand "providing the name of the variable to get."); return false; } - output = dir->GetSafeDefinition(*i); + std::string output = dir->GetSafeDefinition(*i); this->Makefile->AddDefinition(variable, output.c_str()); return true; } - const char *prop = dir->GetProperty(*i); + const char *prop = 0; + if (!i->empty()) + { + if (*i == "DEFINITIONS") + { + switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0059)) + { + case cmPolicies::WARN: + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, + cmPolicies::GetPolicyWarning(cmPolicies::CMP0059)); + case cmPolicies::OLD: + this->StoreResult(variable, + this->Makefile->GetDefineFlagsCMP0059()); + return true; + case cmPolicies::NEW: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + break; + } + } + prop = dir->GetProperty(*i); + } + this->StoreResult(variable, prop); + return true; +} + +void cmGetDirectoryPropertyCommand::StoreResult(std::string const& variable, + const char* prop) +{ if (prop) { this->Makefile->AddDefinition(variable, prop); - return true; + return; } this->Makefile->AddDefinition(variable, ""); - return true; } diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h index 6c5750a..f418886 100644 --- a/Source/cmGetDirectoryPropertyCommand.h +++ b/Source/cmGetDirectoryPropertyCommand.h @@ -40,8 +40,9 @@ public: virtual std::string GetName() const { return "get_directory_property";} cmTypeMacro(cmGetDirectoryPropertyCommand, cmCommand); -}; - +private: + void StoreResult(const std::string& variable, const char* prop); +}; #endif diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 250bd35..33d638b 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -142,8 +142,7 @@ bool cmGetPropertyCommand { // Lookup brief documentation. std::string output; - if(cmPropertyDefinition* def = - this->Makefile->GetState()-> + if(cmPropertyDefinition const* def = this->Makefile->GetState()-> GetPropertyDefinition(this->PropertyName, scope)) { output = def->GetShortDescription(); @@ -158,8 +157,7 @@ bool cmGetPropertyCommand { // Lookup full documentation. std::string output; - if(cmPropertyDefinition* def = - this->Makefile->GetState()-> + if(cmPropertyDefinition const* def = this->Makefile->GetState()-> GetPropertyDefinition(this->PropertyName, scope)) { output = def->GetFullDescription(); @@ -281,6 +279,22 @@ bool cmGetPropertyCommand::HandleDirectoryMode() } } + if (this->PropertyName == "DEFINITIONS") + { + switch(mf->GetPolicyStatus(cmPolicies::CMP0059)) + { + case cmPolicies::WARN: + mf->IssueMessage(cmake::AUTHOR_WARNING, + cmPolicies::GetPolicyWarning(cmPolicies::CMP0059)); + case cmPolicies::OLD: + return this->StoreResult(mf->GetDefineFlagsCMP0059()); + case cmPolicies::NEW: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + break; + } + } + // Get the property. return this->StoreResult(mf->GetProperty(this->PropertyName)); } diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx index 7667a85..46daa34 100644 --- a/Source/cmGetSourceFilePropertyCommand.cxx +++ b/Source/cmGetSourceFilePropertyCommand.cxx @@ -38,7 +38,11 @@ bool cmGetSourceFilePropertyCommand this->Makefile->AddDefinition(var, sf->GetLanguage().c_str()); return true; } - const char *prop = sf->GetPropertyForUser(args[2]); + const char *prop = 0; + if (!args[2].empty()) + { + prop = sf->GetPropertyForUser(args[2]); + } if (prop) { this->Makefile->AddDefinition(var, prop); diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index 315e851..ca40bd0 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -40,7 +40,11 @@ bool cmGetTargetPropertyCommand else if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) { cmTarget& target = *tgt; - const char* prop_cstr = target.GetProperty(args[2], this->Makefile); + const char* prop_cstr = 0; + if (!args[2].empty()) + { + prop_cstr = target.GetProperty(args[2], this->Makefile); + } if(prop_cstr) { prop = prop_cstr; diff --git a/Source/cmGetTestPropertyCommand.cxx b/Source/cmGetTestPropertyCommand.cxx index b3df4c3..bf34589 100644 --- a/Source/cmGetTestPropertyCommand.cxx +++ b/Source/cmGetTestPropertyCommand.cxx @@ -29,7 +29,11 @@ bool cmGetTestPropertyCommand cmTest *test = this->Makefile->GetTest(testName); if (test) { - const char *prop = test->GetProperty(args[1]); + const char *prop = 0; + if (!args[1].empty()) + { + prop = test->GetProperty(args[1]); + } if (prop) { this->Makefile->AddDefinition(var, prop); diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 01e2011..14efc3e 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -21,23 +21,24 @@ std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic"); -cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmTarget *target) - : Target(target) +cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget *target) + : Target(target->Target) + , GeneratorTarget(target) , LocalGenerator(static_cast<cmLocalGhsMultiGenerator *>( - target->GetMakefile()->GetLocalGenerator())) - , Makefile(target->GetMakefile()) - , TargetGroup(DetermineIfTargetGroup(target)) + target->GetLocalGenerator())) + , Makefile(target->Target->GetMakefile()) + , TargetGroup(DetermineIfTargetGroup(target->Target)) , DynamicDownload(false) { - this->RelBuildFilePath = this->GetRelBuildFilePath(target); + this->RelBuildFilePath = this->GetRelBuildFilePath(target->Target); this->RelOutputFileName = this->RelBuildFilePath + this->Target->GetName() + ".a"; this->RelBuildFileName = this->RelBuildFilePath; - this->RelBuildFileName += this->GetBuildFileName(target); + this->RelBuildFileName += this->GetBuildFileName(target->Target); - std::string absPathToRoot = this->GetAbsPathToRoot(target); + std::string absPathToRoot = this->GetAbsPathToRoot(target->Target); absPathToRoot = this->AddSlashIfNeededToPath(absPathToRoot); this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath; this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName; @@ -373,7 +374,6 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries() cmTarget *tg(GetGlobalGenerator()->FindTarget(libName)); if (NULL != tg) { - cmGhsMultiTargetGenerator gmtg(tg); libName = tg->GetName() + ".a"; } *this->GetFolderBuildStreams() << " -l\"" << libName << "\"" diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 8e81db8..c29a31e 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -27,7 +27,7 @@ class cmCustomCommand; class cmGhsMultiTargetGenerator { public: - cmGhsMultiTargetGenerator(cmTarget *target); + cmGhsMultiTargetGenerator(cmGeneratorTarget* target); virtual ~cmGhsMultiTargetGenerator(); @@ -100,6 +100,7 @@ private: const std::string &language); cmTarget *Target; + cmGeneratorTarget* GeneratorTarget; cmLocalGhsMultiGenerator *LocalGenerator; cmMakefile *Makefile; std::string AbsBuildFilePath; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index cd05c54..14eaeac 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -70,7 +70,7 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm) this->TryCompileTimeout = 0; this->ExtraGenerator = 0; - this->CurrentLocalGenerator = 0; + this->CurrentMakefile = 0; this->TryCompileOuterMakefile = 0; } @@ -87,18 +87,16 @@ bool cmGlobalGenerator::SetGeneratorPlatform(std::string const& p, { return true; } - else - { - std::ostringstream e; - e << - "Generator\n" - " " << this->GetName() << "\n" - "does not support platform specification, but platform\n" - " " << p << "\n" - "was specified."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); - return false; - } + + std::ostringstream e; + e << + "Generator\n" + " " << this->GetName() << "\n" + "does not support platform specification, but platform\n" + " " << p << "\n" + "was specified."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; } bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts, @@ -108,18 +106,15 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts, { return true; } - else - { - std::ostringstream e; - e << - "Generator\n" - " " << this->GetName() << "\n" - "does not support toolset specification, but toolset\n" - " " << ts << "\n" - "was specified."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); - return false; - } + std::ostringstream e; + e << + "Generator\n" + " " << this->GetName() << "\n" + "does not support toolset specification, but toolset\n" + " " << ts << "\n" + "was specified."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; } std::string cmGlobalGenerator::SelectMakeProgram( @@ -1106,7 +1101,7 @@ void cmGlobalGenerator::Configure() this->CMakeInstance->GetHomeOutputDirectory()); // now do it - lg->Configure(); + lg->GetMakefile()->Configure(); // update the cache entry for the number of local generators, this is used // for progress @@ -1223,6 +1218,7 @@ void cmGlobalGenerator::Generate() this->CreateDefaultGlobalTargets(&globalTargets); for (i = 0; i < this->LocalGenerators.size(); ++i) { + this->LocalGenerators[i]->ComputeObjectMaxPath(); cmMakefile* mf = this->LocalGenerators[i]->GetMakefile(); cmTargets* targets = &(mf->GetTargets()); cmTargets::iterator tit; @@ -1277,11 +1273,15 @@ void cmGlobalGenerator::Generate() // it builds by default. this->FillLocalGeneratorToTargetMap(); + for (i = 0; i < this->LocalGenerators.size(); ++i) + { + this->LocalGenerators[i]->ComputeHomeRelativeOutputPath(); + } + // Generate project files for (i = 0; i < this->LocalGenerators.size(); ++i) { - this->LocalGenerators[i]->GetMakefile()->SetGeneratingBuildSystem(); - this->SetCurrentLocalGenerator(this->LocalGenerators[i]); + this->SetCurrentMakefile(this->LocalGenerators[i]->GetMakefile()); this->LocalGenerators[i]->Generate(); if(!this->LocalGenerators[i]->GetMakefile()->IsOn( "CMAKE_SKIP_INSTALL_RULES")) @@ -1293,7 +1293,7 @@ void cmGlobalGenerator::Generate() (static_cast<float>(i)+1.0f)/ static_cast<float>(this->LocalGenerators.size())); } - this->SetCurrentLocalGenerator(0); + this->SetCurrentMakefile(0); if(!this->GenerateCPackPropertiesFile()) { @@ -1456,15 +1456,16 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() } //---------------------------------------------------------------------------- -void cmGlobalGenerator::CreateGeneratorTargets(cmMakefile *mf) +void cmGlobalGenerator::CreateGeneratorTargets(cmLocalGenerator *lg) { cmGeneratorTargetsType generatorTargets; + cmMakefile* mf = lg->GetMakefile(); cmTargets& targets = mf->GetTargets(); for(cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti) { cmTarget* t = &ti->second; - cmGeneratorTarget* gt = new cmGeneratorTarget(t); + cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg); this->ComputeTargetObjectDirectory(gt); this->GeneratorTargets[t] = gt; generatorTargets[t] = gt; @@ -1474,7 +1475,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(cmMakefile *mf) j = mf->GetOwnedImportedTargets().begin(); j != mf->GetOwnedImportedTargets().end(); ++j) { - cmGeneratorTarget* gt = new cmGeneratorTarget(*j); + cmGeneratorTarget* gt = new cmGeneratorTarget(*j, lg); this->GeneratorTargets[*j] = gt; generatorTargets[*j] = gt; } @@ -1487,7 +1488,7 @@ void cmGlobalGenerator::CreateGeneratorTargets() // Construct per-target generator information. for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) { - this->CreateGeneratorTargets(this->LocalGenerators[i]->GetMakefile()); + this->CreateGeneratorTargets(this->LocalGenerators[i]); } } @@ -1545,7 +1546,7 @@ void cmGlobalGenerator::CheckLocalGenerators() cmState* state = this->GetCMakeInstance()->GetState(); for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { - this->LocalGenerators[i]->ConfigureFinalPass(); + this->LocalGenerators[i]->GetMakefile()->ConfigureFinalPass(); cmTargets &targets = this->LocalGenerators[i]->GetMakefile()->GetTargets(); for (cmTargets::iterator l = targets.begin(); @@ -2443,7 +2444,6 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( { // Package cmTarget target; - target.GetProperties().SetCMakeInstance(this->CMakeInstance); target.SetType(cmTarget::GLOBAL_TARGET, name); target.SetProperty("EXCLUDE_FROM_ALL","TRUE"); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 979e971..d606cc9 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -168,11 +168,13 @@ public: const std::vector<cmLocalGenerator *>& GetLocalGenerators() const { return this->LocalGenerators;} - cmLocalGenerator* GetCurrentLocalGenerator() - {return this->CurrentLocalGenerator;} + cmMakefile* GetCurrentMakefile() const + { + return this->CurrentMakefile; + } - void SetCurrentLocalGenerator(cmLocalGenerator* lg) - {this->CurrentLocalGenerator = lg;} + void SetCurrentMakefile(cmMakefile* mf) + {this->CurrentMakefile = mf;} void AddLocalGenerator(cmLocalGenerator *lg); @@ -310,8 +312,6 @@ public: { return this->BinaryDirectories.insert(dir).second; } - /** Supported systems creates a GUID for the given name */ - virtual void CreateGUID(const std::string&) {} /** Return true if the generated build tree may contain multiple builds. i.e. "Can I build Debug and Release in the same tree?" */ @@ -398,15 +398,11 @@ protected: std::vector<std::string> depends, const char* workingDir, bool uses_terminal); - bool NeedSymbolicMark; - bool UseLinkScript; - bool ForceUnixPaths; - bool ToolSupportsColor; std::string FindMakeProgramFile; std::string ConfiguredFilesPath; cmake *CMakeInstance; std::vector<cmLocalGenerator *> LocalGenerators; - cmLocalGenerator* CurrentLocalGenerator; + cmMakefile* CurrentMakefile; // map from project name to vector of local generators in that project std::map<std::string, std::vector<cmLocalGenerator*> > ProjectMap; std::map<cmLocalGenerator*, std::set<cmTarget const*> > @@ -414,7 +410,6 @@ protected: // Set of named installation components requested by the project. std::set<std::string> InstallComponents; - bool InstallTargetEnabled; // Sets of named target exports cmExportSetMap ExportSets; std::map<std::string, cmExportBuildFileGenerator*> BuildExportSets; @@ -448,7 +443,6 @@ private: cmState::Snapshot snapshot); cmMakefile* TryCompileOuterMakefile; - float FirstTimeProgress; // If you add a new map here, make sure it is copied // in EnableLanguagesFromGenerator std::map<std::string, bool> IgnoreExtensions; @@ -489,7 +483,7 @@ private: // Per-target generator information. cmGeneratorTargetsType GeneratorTargets; friend class cmake; - void CreateGeneratorTargets(cmMakefile* mf); + void CreateGeneratorTargets(cmLocalGenerator* lg); void CreateGeneratorTargets(); void ClearGeneratorMembers(); @@ -521,6 +515,14 @@ private: // Pool of file locks cmFileLockPool FileLockPool; #endif + +protected: + float FirstTimeProgress; + bool NeedSymbolicMark; + bool UseLinkScript; + bool ForceUnixPaths; + bool ToolSupportsColor; + bool InstallTargetEnabled; }; #endif diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 4fe52dd..0f61225 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -529,7 +529,7 @@ cmGlobalUnixMakefileGenerator3 cmLocalUnixMakefileGenerator3* lg) { // Only subdirectories need these rules. - if(lg->IsRootMakefile()) + if(lg->GetMakefile()->IsRootMakefile()) { return; } @@ -1034,7 +1034,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]); // for the passed in makefile or if this is the top Makefile wripte out // the targets - if (lg2 == lg || lg->IsRootMakefile()) + if (lg2 == lg || lg->GetMakefile()->IsRootMakefile()) { // for each target Generate the rule files for each target. cmTargets& targets = lg2->GetMakefile()->GetTargets(); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 4dd54d0..f453da1 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -15,6 +15,7 @@ #include "cmGeneratedFileStream.h" #include "cmLocalVisualStudio7Generator.h" #include "cmMakefile.h" +#include "cmUuid.h" #include "cmake.h" #include <cmsys/Encoding.hxx> @@ -513,8 +514,6 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( cumulativePath = cumulativePath + "/" + *iter; } - - this->CreateGUID(cumulativePath.c_str()); } if (!cumulativePath.empty()) @@ -899,7 +898,6 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target) fname += ".vcproj"; cmGeneratedFileStream fout(fname.c_str()); fout.SetCopyIfDifferent(true); - this->CreateGUID(pname.c_str()); std::string guid = this->GetGUID(pname.c_str()); fout << @@ -943,41 +941,29 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target) return pname; } -std::string cmGlobalVisualStudio7Generator::GetGUID(const std::string& name) +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio7Generator::GetGUID(std::string const& name) { - std::string guidStoreName = name; - guidStoreName += "_GUID_CMAKE"; - const char* storedGUID = - this->CMakeInstance->GetCacheDefinition(guidStoreName.c_str()); - if(storedGUID) + std::string const& guidStoreName = name + "_GUID_CMAKE"; + if (const char* storedGUID = + this->CMakeInstance->GetCacheDefinition(guidStoreName.c_str())) { return std::string(storedGUID); } - cmSystemTools::Error("Unknown Target referenced : ", - name.c_str()); - return ""; -} + // Compute a GUID that is deterministic but unique to the build tree. + std::string input = this->CMakeInstance->GetState()->GetBinaryDirectory(); + input += "|"; + input += name; + cmUuid uuidGenerator; -void cmGlobalVisualStudio7Generator::CreateGUID(const std::string& name) -{ - std::string guidStoreName = name; - guidStoreName += "_GUID_CMAKE"; - if(this->CMakeInstance->GetCacheDefinition(guidStoreName.c_str())) - { - return; - } - std::string ret; - UUID uid; - unsigned short *uidstr; - UuidCreate(&uid); - UuidToStringW(&uid,&uidstr); - ret = cmsys::Encoding::ToNarrow(reinterpret_cast<wchar_t*>(uidstr)); - RpcStringFreeW(&uidstr); - ret = cmSystemTools::UpperCase(ret); - this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(), - ret.c_str(), "Stored GUID", - cmState::INTERNAL); + std::vector<unsigned char> uuidNamespace; + uuidGenerator.StringToBinary( + "ee30c4be-5192-4fb0-b335-722a2dffe760", uuidNamespace); + + std::string guid = uuidGenerator.FromMd5(uuidNamespace, input); + + return cmSystemTools::UpperCase(guid); } //---------------------------------------------------------------------------- @@ -1039,12 +1025,13 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( { return activeConfigs; } + cmGeneratorTarget* gt = this->GetGeneratorTarget(target); // inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties for(std::vector<std::string>::const_iterator i = configs.begin(); i != configs.end(); ++i) { const char* propertyValue = - target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str()); + gt->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str()); if(cmSystemTools::IsOff(propertyValue)) { activeConfigs.insert(*i); diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index c98d269..931ac9c 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -80,9 +80,8 @@ public: */ virtual void OutputSLNFile(); - ///! Create a GUID or get an existing one. - void CreateGUID(const std::string& name); - std::string GetGUID(const std::string& name); + ///! Lookup a stored GUID or compute one deterministically. + std::string GetGUID(std::string const& name); /** Append the subdirectory for the given configuration. */ virtual void AppendDirectoryForConfig(const std::string& prefix, diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index a3ebc61..b96a799 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -185,7 +185,6 @@ void cmGlobalVisualStudio8Generator void cmGlobalVisualStudio8Generator::Configure() { this->cmGlobalVisualStudio7Generator::Configure(); - this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET); } //---------------------------------------------------------------------------- @@ -310,14 +309,10 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() cmCustomCommandLine commandLine; commandLine.push_back(cmSystemTools::GetCMakeCommand()); std::string argH = "-H"; - argH += lg->Convert(mf->GetHomeDirectory(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::UNCHANGED, true); + argH += mf->GetHomeDirectory(); commandLine.push_back(argH); std::string argB = "-B"; - argB += lg->Convert(mf->GetHomeOutputDirectory(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::UNCHANGED, true); + argB += mf->GetHomeOutputDirectory(); commandLine.push_back(argB); commandLine.push_back("--check-stamp-list"); commandLine.push_back(stampList.c_str()); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 7464e90..1301e3e 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3804,33 +3804,13 @@ void cmGlobalXCodeGenerator::GetDocumentation(cmDocumentationEntry& entry) //---------------------------------------------------------------------------- std::string cmGlobalXCodeGenerator::ConvertToRelativeForMake(const char* p) { - if ( !this->CurrentMakefile->IsOn("CMAKE_USE_RELATIVE_PATHS") ) - { - return cmSystemTools::ConvertToOutputPath(p); - } - else - { - std::string ret = - this->CurrentLocalGenerator-> - ConvertToRelativePath(this->CurrentOutputDirectoryComponents, p); - return cmSystemTools::ConvertToOutputPath(ret.c_str()); - } + return cmSystemTools::ConvertToOutputPath(p); } //---------------------------------------------------------------------------- std::string cmGlobalXCodeGenerator::ConvertToRelativeForXCode(const char* p) { - if ( !this->CurrentMakefile->IsOn("CMAKE_USE_RELATIVE_PATHS") ) - { - return cmSystemTools::ConvertToOutputPath(p); - } - else - { - std::string ret = - this->CurrentLocalGenerator-> - ConvertToRelativePath(this->ProjectOutputDirectoryComponents, p); - return cmSystemTools::ConvertToOutputPath(ret.c_str()); - } + return cmSystemTools::ConvertToOutputPath(p); } //---------------------------------------------------------------------------- diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 7f4c4c9..fa29b4f 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -48,6 +48,7 @@ cmGraphVizWriter::cmGraphVizWriter(const std::vector<cmLocalGenerator*>& ,GraphName("GG") ,GraphHeader("node [\n fontsize = \"12\"\n];") ,GraphNodePrefix("node") +,LocalGenerators(localGenerators) ,GenerateForExecutables(true) ,GenerateForStaticLibs(true) ,GenerateForSharedLibs(true) @@ -55,7 +56,6 @@ cmGraphVizWriter::cmGraphVizWriter(const std::vector<cmLocalGenerator*>& ,GenerateForExternals(true) ,GeneratePerTarget(true) ,GenerateDependers(true) -,LocalGenerators(localGenerators) ,HaveTargetsAndLibs(false) { } diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index a7acd0e..64de684 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -69,14 +69,6 @@ protected: std::string GraphHeader; std::string GraphNodePrefix; - bool GenerateForExecutables; - bool GenerateForStaticLibs; - bool GenerateForSharedLibs; - bool GenerateForModuleLibs; - bool GenerateForExternals; - bool GeneratePerTarget; - bool GenerateDependers; - std::vector<cmsys::RegularExpression> TargetsToIgnoreRegex; const std::vector<cmLocalGenerator*>& LocalGenerators; @@ -85,6 +77,13 @@ protected: // maps from the actual target names to node names in dot: std::map<std::string, std::string> TargetNamesNodes; + bool GenerateForExecutables; + bool GenerateForStaticLibs; + bool GenerateForSharedLibs; + bool GenerateForModuleLibs; + bool GenerateForExternals; + bool GeneratePerTarget; + bool GenerateDependers; bool HaveTargetsAndLibs; }; diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 3551f83..20448c1 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -27,7 +27,7 @@ static std::string cmIfCommandError( i != args.end(); ++i) { err += " "; - err += cmLocalGenerator::EscapeForCMake(i->GetValue()); + err += cmOutputConverter::EscapeForCMake(i->GetValue()); } err += "\n"; return err; @@ -92,10 +92,6 @@ IsFunctionBlocked(const cmListFileFunction& lff, } else { - // Place this call on the call stack. - cmMakefileCall stack_manager(&mf, this->Functions[c], status); - static_cast<void>(stack_manager); - // if trace is enabled, print the evaluated "elseif" statement if(mf.GetCMakeInstance()->GetTrace()) { @@ -119,7 +115,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, { std::string err = cmIfCommandError(expandedArguments); err += errorString; - mf.IssueMessage(messType, err); + cmListFileBacktrace bt = mf.GetBacktrace(this->Functions[c]); + mf.GetCMakeInstance()->IssueMessage(messType, err, bt); if (messType == cmake::FATAL_ERROR) { cmSystemTools::SetFatalErrorOccured(); diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 28c27c2..ff2c6e5 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -28,9 +28,11 @@ cmInstallFilesGenerator bool optional): cmInstallGenerator(dest, configurations, component, message), Makefile(mf), - Files(files), Programs(programs), + Files(files), FilePermissions(file_permissions), - Rename(rename), Optional(optional) + Rename(rename), + Programs(programs), + Optional(optional) { // We need per-config actions if any files have generator expressions. for(std::vector<std::string>::const_iterator i = files.begin(); diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 0dbd712..bf482d6 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -43,9 +43,9 @@ protected: cmMakefile* Makefile; std::vector<std::string> Files; - bool Programs; std::string FilePermissions; std::string Rename; + bool Programs; bool Optional; }; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 082a78c..5115788 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -29,7 +29,9 @@ cmInstallTargetGenerator MessageLevel message, bool optional): cmInstallGenerator(dest, configurations, component, message), Target(&t), - ImportLibrary(implib), FilePermissions(file_permissions), Optional(optional) + FilePermissions(file_permissions), + ImportLibrary(implib), + Optional(optional) { this->ActionsPerConfig = true; this->NamelinkMode = NamelinkModeNone; diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 075c8a4..db69220 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -14,7 +14,6 @@ #include "cmInstallGenerator.h" #include "cmTarget.h" -#include "cmGeneratorTarget.h" /** \class cmInstallTargetGenerator * \brief Generate target installation rules. @@ -100,11 +99,10 @@ protected: const std::string& toDestDirPath); cmTarget* Target; - bool ImportLibrary; std::string FilePermissions; - bool Optional; NamelinkModeType NamelinkMode; - cmGeneratorTarget* GeneratorTarget; + bool ImportLibrary; + bool Optional; }; #endif diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h new file mode 100644 index 0000000..d2339c4 --- /dev/null +++ b/Source/cmLinkedTree.h @@ -0,0 +1,164 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Stephen Kelly <steveire@gmail.com> + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmLinkedTree_h +#define cmLinkedTree_h + +#include "cmStandardIncludes.h" + +#include <assert.h> + +/** + @brief A adaptor for traversing a tree structure in a vector + + This class is not intended to be wholly generic like a standard library + container adaptor. Mostly it exists to facilitate code sharing for the + needs of the cmState. For example, the Truncate() method is a specific + requirement of the cmState. + + An empty cmLinkedTree provides a Root() method, and an Extend() method, + each of which return iterators. A Tree can be built up by extending + from the root, and then extending from any other iterator. + + An iterator resulting from this tree construction can be + forward-only-iterated toward the root. Extending the tree never + invalidates existing iterators. + */ +template<typename T> +class cmLinkedTree +{ + typedef typename std::vector<T>::size_type PositionType; + typedef T* PointerType; + typedef T& ReferenceType; +public: + class iterator : public std::iterator<std::forward_iterator_tag, T> + { + friend class cmLinkedTree; + cmLinkedTree* Tree; + + // The Position is always 'one past the end'. + PositionType Position; + + iterator(cmLinkedTree* tree, PositionType pos) + : Tree(tree), Position(pos) + { + + } + + public: + iterator() + : Tree(0), Position(0) + { + + } + + void operator++() + { + assert(this->Tree); + assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); + assert(this->Position <= this->Tree->Data.size()); + assert(this->Position > 0); + this->Position = this->Tree->UpPositions[this->Position - 1]; + } + + PointerType operator->() const + { + assert(this->Tree); + assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); + assert(this->Position <= this->Tree->Data.size()); + assert(this->Position > 0); + return this->Tree->GetPointer(this->Position - 1); + } + + PointerType operator->() + { + assert(this->Tree); + assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); + assert(this->Position <= this->Tree->Data.size()); + assert(this->Position > 0); + return this->Tree->GetPointer(this->Position - 1); + } + + bool operator==(iterator other) const + { + assert(this->Tree); + assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); + assert(this->Tree == other.Tree); + return this->Position == other.Position; + } + + bool operator!=(iterator other) const + { + assert(this->Tree); + assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); + return !(*this == other); + } + + bool IsValid() const + { + if (!this->Tree) + { + return false; + } + return this->Position <= this->Tree->Data.size(); + } + }; + + iterator Root() const + { + return iterator(const_cast<cmLinkedTree*>(this), 0); + } + + iterator Extend(iterator it) + { + return Extend_impl(it, T()); + } + + iterator Extend(iterator it, T t) + { + return Extend_impl(it, t); + } + + iterator Truncate() + { + assert(this->UpPositions.size() > 0); + this->UpPositions.erase(this->UpPositions.begin() + 1, + this->UpPositions.end()); + assert(this->Data.size() > 0); + this->Data.erase(this->Data.begin() + 1, this->Data.end()); + return iterator(this, 1); + } + +private: + T& GetReference(PositionType pos) + { + return this->Data[pos]; + } + + T* GetPointer(PositionType pos) + { + return &this->Data[pos]; + } + + iterator Extend_impl(iterator it, T t) + { + assert(this->UpPositions.size() == this->Data.size()); + assert(it.Position <= this->UpPositions.size()); + this->UpPositions.push_back(it.Position); + this->Data.push_back(t); + return iterator(this, this->UpPositions.size()); + } + + std::vector<T> Data; + std::vector<PositionType> UpPositions; +}; + +#endif diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 2756cd2..006ca4c 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -234,8 +234,7 @@ bool cmListFile::ParseFile(const char* filename, { cmListFileFunction project; project.Name = "PROJECT"; - cmListFileArgument prj("Project", cmListFileArgument::Unquoted, - filename, 0); + cmListFileArgument prj("Project", cmListFileArgument::Unquoted, 0); project.Arguments.push_back(prj); this->Functions.insert(this->Functions.begin(),project); } @@ -375,7 +374,7 @@ bool cmListFileParser::ParseFunction(const char* name, long line) bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, cmListFileArgument::Delimiter delim) { - cmListFileArgument a(token->text, delim, this->FileName, token->line); + cmListFileArgument a(token->text, delim, token->line); this->Function.Arguments.push_back(a); if(this->Separation == SeparationOkay) { @@ -405,29 +404,17 @@ void cmListFileBacktrace::Append(cmListFileContext const& context) this->push_back(context); } -//---------------------------------------------------------------------------- -void cmListFileBacktrace::MakeRelative() -{ - if (this->Relative) - { - return; - } - for (cmListFileBacktrace::iterator i = this->begin(); - i != this->end(); ++i) - { - i->FilePath = this->LocalGenerator->Convert(i->FilePath, - cmLocalGenerator::HOME); - } - this->Relative = true; -} - void cmListFileBacktrace::PrintTitle(std::ostream& out) { if (this->empty()) { return; } - out << (this->front().Line ? " at " : " in ") << this->front(); + + cmOutputConverter converter(this->Snapshot); + cmListFileContext lfc = this->front(); + lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME); + out << (lfc.Line ? " at " : " in ") << lfc; } void cmListFileBacktrace::PrintCallStack(std::ostream& out) @@ -437,11 +424,13 @@ void cmListFileBacktrace::PrintCallStack(std::ostream& out) return; } + cmOutputConverter converter(this->Snapshot); const_iterator i = this->begin() + 1; out << "Call Stack (most recent call first):\n"; while(i != this->end()) { - cmListFileContext const& lfc = *i; + cmListFileContext lfc = *i; + lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME); out << " " << lfc << "\n"; ++i; } diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 4a1d181..f5859ec 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -14,7 +14,7 @@ #include "cmStandardIncludes.h" -class cmLocalGenerator; +#include "cmState.h" /** \class cmListFileCache * \brief A class to cache list file contents. @@ -33,12 +33,11 @@ struct cmListFileArgument Quoted, Bracket }; - cmListFileArgument(): Value(), Delim(Unquoted), FilePath(0), Line(0) {} - cmListFileArgument(const cmListFileArgument& r): - Value(r.Value), Delim(r.Delim), FilePath(r.FilePath), Line(r.Line) {} - cmListFileArgument(const std::string& v, Delimiter d, const char* file, - long line): Value(v), Delim(d), - FilePath(file), Line(line) {} + cmListFileArgument(): Value(), Delim(Unquoted), Line(0) {} + cmListFileArgument(const cmListFileArgument& r) + : Value(r.Value), Delim(r.Delim), Line(r.Line) {} + cmListFileArgument(const std::string& v, Delimiter d, long line) + : Value(v), Delim(d), Line(line) {} bool operator == (const cmListFileArgument& r) const { return (this->Value == r.Value) && (this->Delim == r.Delim); @@ -49,7 +48,6 @@ struct cmListFileArgument } std::string Value; Delimiter Delim; - const char* FilePath; long Line; }; @@ -74,21 +72,17 @@ struct cmListFileFunction: public cmListFileContext class cmListFileBacktrace: private std::vector<cmListFileContext> { public: - cmListFileBacktrace(cmLocalGenerator* localGen) - : LocalGenerator(localGen) - , Relative(localGen ? false : true) + cmListFileBacktrace(cmState::Snapshot snapshot = cmState::Snapshot()) + : Snapshot(snapshot) { } void Append(cmListFileContext const& context); - void MakeRelative(); - void PrintTitle(std::ostream& out); void PrintCallStack(std::ostream& out); private: - cmLocalGenerator* LocalGenerator; - bool Relative; + cmState::Snapshot Snapshot; }; struct cmListFile diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index eb6b871..6f98ee2 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -46,7 +46,7 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent, cmState::Snapshot snapshot) - : StateSnapshot(snapshot) + : cmOutputConverter(snapshot), StateSnapshot(snapshot) { assert(snapshot.IsValid()); this->GlobalGenerator = gg; @@ -58,9 +58,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->Makefile = new cmMakefile(this); - this->LinkScriptShell = false; - this->UseRelativePaths = false; - this->Configured = false; this->EmitUniversalBinaryFlags = true; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; @@ -71,79 +68,20 @@ cmLocalGenerator::~cmLocalGenerator() delete this->Makefile; } -bool cmLocalGenerator::IsRootMakefile() const +void cmLocalGenerator::IssueMessage(cmake::MessageType t, + std::string const& text) const { - return !this->StateSnapshot.GetParent().IsValid(); -} + cmListFileContext lfc; + lfc.FilePath = this->StateSnapshot.GetCurrentSourceDirectory(); + lfc.FilePath += "/CMakeLists.txt"; -//---------------------------------------------------------------------------- -class cmLocalGeneratorCurrent -{ - cmGlobalGenerator* GG; - cmLocalGenerator* LG; - cmState::Snapshot Snapshot; -public: - cmLocalGeneratorCurrent(cmLocalGenerator* lg) + if(!this->GlobalGenerator->GetCMakeInstance()->GetIsInTryCompile()) { - this->GG = lg->GetGlobalGenerator(); - this->LG = this->GG->GetCurrentLocalGenerator(); - this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot(); - this->GG->GetCMakeInstance()->SetCurrentSnapshot(lg->GetStateSnapshot()); - this->GG->SetCurrentLocalGenerator(lg); -#if defined(CMAKE_BUILD_WITH_CMAKE) - this->GG->GetFileLockPool().PushFileScope(); -#endif + cmOutputConverter converter(this->StateSnapshot); + lfc.FilePath = converter.Convert(lfc.FilePath, cmLocalGenerator::HOME); } - ~cmLocalGeneratorCurrent() - { -#if defined(CMAKE_BUILD_WITH_CMAKE) - this->GG->GetFileLockPool().PopFileScope(); -#endif - this->GG->SetCurrentLocalGenerator(this->LG); - this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); - } -}; - -//---------------------------------------------------------------------------- -void cmLocalGenerator::Configure() -{ - // Manage the global generator's current local generator. - cmLocalGeneratorCurrent clg(this); - static_cast<void>(clg); - - // make sure the CMakeFiles dir is there - std::string filesDir = this->StateSnapshot.GetCurrentBinaryDirectory(); - filesDir += cmake::GetCMakeFilesDirectory(); - cmSystemTools::MakeDirectory(filesDir.c_str()); - - std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory(); - currentStart += "/CMakeLists.txt"; - assert(cmSystemTools::FileExists(currentStart.c_str(), true)); - this->Makefile->ProcessBuildsystemFile(currentStart.c_str()); - - // at the end of the ReadListFile handle any old style subdirs - // first get all the subdirectories - std::vector<cmLocalGenerator *> subdirs = this->GetChildren(); - - // for each subdir recurse - std::vector<cmLocalGenerator *>::iterator sdi = subdirs.begin(); - for (; sdi != subdirs.end(); ++sdi) - { - if (!(*sdi)->Configured) - { - this->Makefile->ConfigureSubDirectory(*sdi); - } - } - - this->Makefile->AddCMakeDependFilesFromUser(); - - // Check whether relative paths should be used for optionally - // relative paths. - this->UseRelativePaths = this->Makefile->IsOn("CMAKE_USE_RELATIVE_PATHS"); - - this->ComputeObjectMaxPath(); - - this->Configured = true; + lfc.Line = 0; + this->GlobalGenerator->GetCMakeInstance()->IssueMessage(t, text, lfc); } //---------------------------------------------------------------------------- @@ -171,7 +109,7 @@ void cmLocalGenerator::ComputeObjectMaxPath() w << "CMAKE_OBJECT_PATH_MAX is set to " << pmax << ", which is less than the minimum of 128. " << "The value will be ignored."; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } } else @@ -180,17 +118,12 @@ void cmLocalGenerator::ComputeObjectMaxPath() w << "CMAKE_OBJECT_PATH_MAX is set to \"" << plen << "\", which fails to parse as a positive integer. " << "The value will be ignored."; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } } this->ObjectMaxPathViolations.clear(); } -void cmLocalGenerator::ConfigureFinalPass() -{ - this->Makefile->ConfigureFinalPass(); -} - void cmLocalGenerator::TraceDependencies() { std::vector<std::string> configs; @@ -522,7 +455,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, objectDir = this->Convert(objectDir,START_OUTPUT,SHELL); std::string objectFile = this->Convert(ofname,START_OUTPUT,SHELL); std::string sourceFile = - this->Convert(source.GetFullPath(),START_OUTPUT,SHELL,true); + this->ConvertToOutputFormat(source.GetFullPath(), SHELL); std::string varString = "CMAKE_"; varString += lang; varString += "_COMPILE_OBJECT"; @@ -1169,56 +1102,6 @@ void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target, //---------------------------------------------------------------------------- std::string -cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote, - std::string const& result, - OutputFormat format) -{ - // If this is a windows shell, the result has a space, and the path - // already exists, we can use a short-path to reference it without a - // space. - if(this->GetState()->UseWindowsShell() && result.find(' ') != result.npos && - cmSystemTools::FileExists(remote.c_str())) - { - std::string tmp; - if(cmSystemTools::GetShortPath(remote, tmp)) - { - return this->Convert(tmp, NONE, format, true); - } - } - - // Otherwise, leave it unchanged. - return result; -} - -//---------------------------------------------------------------------------- -std::string -cmLocalGenerator::ConvertToOutputForExisting(const std::string& remote, - RelativeRoot local, - OutputFormat format) -{ - // Perform standard conversion. - std::string result = this->Convert(remote, local, format, true); - - // Consider short-path. - return this->ConvertToOutputForExistingCommon(remote, result, format); -} - -//---------------------------------------------------------------------------- -std::string -cmLocalGenerator::ConvertToOutputForExisting(RelativeRoot remote, - const std::string& local, - OutputFormat format) -{ - // Perform standard conversion. - std::string result = this->Convert(remote, local, format, true); - - // Consider short-path. - const char* remotePath = this->GetRelativeRootPath(remote); - return this->ConvertToOutputForExistingCommon(remotePath, result, format); -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::ConvertToIncludeReference(std::string const& path, OutputFormat format, bool forceFullPaths) @@ -1316,8 +1199,7 @@ std::string cmLocalGenerator::GetIncludeFlags( { includeFlags << fwSearchFlag; } - includeFlags << this->Convert(frameworkDir, START_OUTPUT, - shellFormat, true) + includeFlags << this->ConvertToOutputFormat(frameworkDir, shellFormat) << " "; } continue; @@ -1446,7 +1328,7 @@ void cmLocalGenerator::AddCompileOptions( "higher \"" << it->first << "_STANDARD\" \"" << standard << "\". " "This is not permitted. The COMPILE_FEATURES may not both depend on " "and be depended on by the link implementation." << std::endl; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } } @@ -1459,7 +1341,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, const std::string& lang, const std::string& config, bool stripImplicitInclDirs - ) + ) const { // Need to decide whether to automatically include the source and // binary directories at the beginning of the include path. @@ -2170,7 +2052,7 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget const* target, "dialect \"" << lang << standardProp << "\" " << (ext ? "(with compiler extensions)" : "") << ", but CMake " "does not know the compile flags to use to enable it."; - this->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(cmake::FATAL_ERROR, e.str()); } else { @@ -2214,7 +2096,7 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget const* target, std::string e = "CMAKE_" + lang + "_STANDARD_DEFAULT is set to invalid value '" + std::string(defaultStd) + "'"; - this->Makefile->IssueMessage(cmake::INTERNAL_ERROR, e); + this->IssueMessage(cmake::INTERNAL_ERROR, e); return; } @@ -2430,7 +2312,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared, << flagsVar << " was removed.\n" << cmPolicies::GetPolicyWarning(cmPolicies::CMP0018); - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); // fall through to OLD behaviour } case cmPolicies::OLD: @@ -2644,6 +2526,33 @@ void cmLocalGenerator::AppendFeatureOptions( } //---------------------------------------------------------------------------- +const char* cmLocalGenerator::GetFeature(const std::string& feature, + const std::string& config) +{ + // TODO: Define accumulation policy for features (prepend, append, replace). + // Currently we always replace. + if(!config.empty()) + { + std::string featureConfig = feature; + featureConfig += "_"; + featureConfig += cmSystemTools::UpperCase(config); + if(const char* value = this->Makefile->GetProperty(featureConfig)) + { + return value; + } + } + if(const char* value = this->Makefile->GetProperty(feature)) + { + return value; + } + if(cmLocalGenerator* parent = this->GetParent()) + { + return parent->GetFeature(feature, config); + } + return 0; +} + +//---------------------------------------------------------------------------- std::string cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg, const char* default_comment) @@ -2675,242 +2584,6 @@ cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg, } //---------------------------------------------------------------------------- -std::string -cmLocalGenerator::ConvertToOptionallyRelativeOutputPath( - const std::string& remote) -{ - return this->Convert(remote, START_OUTPUT, SHELL, true); -} - -//---------------------------------------------------------------------------- -const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot) -{ - switch (relroot) - { - case HOME: return this->GetState()->GetSourceDirectory(); - case START: return this->StateSnapshot.GetCurrentSourceDirectory(); - case HOME_OUTPUT: return this->GetState()->GetBinaryDirectory(); - case START_OUTPUT: return this->StateSnapshot.GetCurrentBinaryDirectory(); - default: break; - } - return 0; -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::Convert(const std::string& source, - RelativeRoot relative, - OutputFormat output, - bool optional) -{ - // Convert the path to a relative path. - std::string result = source; - - if (!optional || this->UseRelativePaths) - { - switch (relative) - { - case HOME: - //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath( - this->GetState()->GetSourceDirectoryComponents(), result); - break; - case START: - //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath( - this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); - break; - case HOME_OUTPUT: - //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath( - this->GetState()->GetBinaryDirectoryComponents(), result); - break; - case START_OUTPUT: - //result = cmSystemTools::CollapseFullPath(result.c_str()); - result = this->ConvertToRelativePath( - this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); - break; - case FULL: - result = cmSystemTools::CollapseFullPath(result); - break; - case NONE: - break; - } - } - return this->ConvertToOutputFormat(result, output); -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, - OutputFormat output) -{ - std::string result = source; - // Convert it to an output path. - if (output == MAKERULE) - { - result = cmSystemTools::ConvertToOutputPath(result.c_str()); - } - else if(output == SHELL || output == WATCOMQUOTE) - { - // For the MSYS shell convert drive letters to posix paths, so - // that c:/some/path becomes /c/some/path. This is needed to - // avoid problems with the shell path translation. - if(this->GetState()->UseMSYSShell() && !this->LinkScriptShell) - { - if(result.size() > 2 && result[1] == ':') - { - result[1] = result[0]; - result[0] = '/'; - } - } - if(this->GetState()->UseWindowsShell()) - { - std::replace(result.begin(), result.end(), '/', '\\'); - } - result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE); - } - else if(output == RESPONSE) - { - result = this->EscapeForShell(result, false, false, false); - } - return result; -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::Convert(RelativeRoot remote, - const std::string& local, - OutputFormat output, - bool optional) -{ - const char* remotePath = this->GetRelativeRootPath(remote); - - // The relative root must have a path (i.e. not FULL or NONE) - assert(remotePath != 0); - - if(!local.empty() && (!optional || this->UseRelativePaths)) - { - std::vector<std::string> components; - cmSystemTools::SplitPath(local, components); - std::string result = this->ConvertToRelativePath(components, remotePath); - return this->ConvertToOutputFormat(result, output); - } - else - { - return this->ConvertToOutputFormat(remotePath, output); - } -} - -//---------------------------------------------------------------------------- -static bool cmLocalGeneratorNotAbove(const char* a, const char* b) -{ - return (cmSystemTools::ComparePath(a, b) || - cmSystemTools::IsSubDirectory(a, b)); -} - -//---------------------------------------------------------------------------- -std::string -cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local, - const std::string& in_remote, - bool force) -{ - // The path should never be quoted. - assert(in_remote[0] != '\"'); - - // The local path should never have a trailing slash. - assert(!local.empty() && !(local[local.size()-1] == "")); - - // If the path is already relative then just return the path. - if(!cmSystemTools::FileIsFullPath(in_remote.c_str())) - { - return in_remote; - } - - if(!force) - { - // Skip conversion if the path and local are not both in the source - // or both in the binary tree. - std::string local_path = cmSystemTools::JoinPath(local); - if(!((cmLocalGeneratorNotAbove(local_path.c_str(), - this->StateSnapshot.GetRelativePathTopBinary()) && - cmLocalGeneratorNotAbove(in_remote.c_str(), - this->StateSnapshot.GetRelativePathTopBinary())) || - (cmLocalGeneratorNotAbove(local_path.c_str(), - this->StateSnapshot.GetRelativePathTopSource()) && - cmLocalGeneratorNotAbove(in_remote.c_str(), - this->StateSnapshot.GetRelativePathTopSource())))) - { - return in_remote; - } - } - - // Identify the longest shared path component between the remote - // path and the local path. - std::vector<std::string> remote; - cmSystemTools::SplitPath(in_remote, remote); - unsigned int common=0; - while(common < remote.size() && - common < local.size() && - cmSystemTools::ComparePath(remote[common], - local[common])) - { - ++common; - } - - // If no part of the path is in common then return the full path. - if(common == 0) - { - return in_remote; - } - - // If the entire path is in common then just return a ".". - if(common == remote.size() && - common == local.size()) - { - return "."; - } - - // If the entire path is in common except for a trailing slash then - // just return a "./". - if(common+1 == remote.size() && - remote[common].empty() && - common == local.size()) - { - return "./"; - } - - // Construct the relative path. - std::string relative; - - // First add enough ../ to get up to the level of the shared portion - // of the path. Leave off the trailing slash. Note that the last - // component of local will never be empty because local should never - // have a trailing slash. - for(unsigned int i=common; i < local.size(); ++i) - { - relative += ".."; - if(i < local.size()-1) - { - relative += "/"; - } - } - - // Now add the portion of the destination path that is not included - // in the shared portion of the path. Add a slash the first time - // only if there was already something in the path. If there was a - // trailing slash in the input then the last iteration of the loop - // will add a slash followed by an empty string which will preserve - // the trailing slash in the output. - - if(!relative.empty() && !remote.empty()) - { - relative += "/"; - } - relative += cmJoin(cmRange(remote).advance(common), "/"); - - // Finally return the path. - return relative; -} - -//---------------------------------------------------------------------------- class cmInstallTargetGeneratorLocal: public cmInstallTargetGenerator { public: @@ -3151,7 +2824,7 @@ cmLocalGenerator << " " << ssin << "\n" << "cannot be safely placed under this directory. " << "The build may not work correctly."; - this->Makefile->IssueMessage(cmake::WARNING, m.str()); + this->IssueMessage(cmake::WARNING, m.str()); } } #else @@ -3195,11 +2868,6 @@ bool cmLocalGenerator::IsNMake() const return this->GetState()->UseNMake(); } -void cmLocalGenerator::SetConfiguredCMP0014(bool configured) -{ - this->Configured = configured; -} - //---------------------------------------------------------------------------- std::string cmLocalGenerator @@ -3308,150 +2976,6 @@ cmLocalGenerator } //---------------------------------------------------------------------------- -static bool cmLocalGeneratorIsShellOperator(const std::string& str) -{ - static std::set<std::string> shellOperators; - if(shellOperators.empty()) - { - shellOperators.insert("<"); - shellOperators.insert(">"); - shellOperators.insert("<<"); - shellOperators.insert(">>"); - shellOperators.insert("|"); - shellOperators.insert("||"); - shellOperators.insert("&&"); - shellOperators.insert("&>"); - shellOperators.insert("1>"); - shellOperators.insert("2>"); - shellOperators.insert("2>&1"); - shellOperators.insert("1>&2"); - } - return shellOperators.count(str) > 0; -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::EscapeForShell(const std::string& str, - bool makeVars, - bool forEcho, - bool useWatcomQuote) -{ - // Do not escape shell operators. - if(cmLocalGeneratorIsShellOperator(str)) - { - return str; - } - - // Compute the flags for the target shell environment. - int flags = 0; - if(this->GetState()->UseWindowsVSIDE()) - { - flags |= cmsysSystem_Shell_Flag_VSIDE; - } - else if(!this->LinkScriptShell) - { - flags |= cmsysSystem_Shell_Flag_Make; - } - if(makeVars) - { - flags |= cmsysSystem_Shell_Flag_AllowMakeVariables; - } - if(forEcho) - { - flags |= cmsysSystem_Shell_Flag_EchoWindows; - } - if(useWatcomQuote) - { - flags |= cmsysSystem_Shell_Flag_WatcomQuote; - } - if(this->GetState()->UseWatcomWMake()) - { - flags |= cmsysSystem_Shell_Flag_WatcomWMake; - } - if(this->GetState()->UseMinGWMake()) - { - flags |= cmsysSystem_Shell_Flag_MinGWMake; - } - if(this->GetState()->UseNMake()) - { - flags |= cmsysSystem_Shell_Flag_NMake; - } - - // Compute the buffer size needed. - int size = (this->GetState()->UseWindowsShell() ? - cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) : - cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags)); - - // Compute the shell argument itself. - std::vector<char> arg(size); - if(this->GetState()->UseWindowsShell()) - { - cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags); - } - else - { - cmsysSystem_Shell_GetArgumentForUnix(str.c_str(), &arg[0], flags); - } - return std::string(&arg[0]); -} - -//---------------------------------------------------------------------------- -std::string cmLocalGenerator::EscapeForCMake(const std::string& str) -{ - // Always double-quote the argument to take care of most escapes. - std::string result = "\""; - for(const char* c = str.c_str(); *c; ++c) - { - if(*c == '"') - { - // Escape the double quote to avoid ending the argument. - result += "\\\""; - } - else if(*c == '$') - { - // Escape the dollar to avoid expanding variables. - result += "\\$"; - } - else if(*c == '\\') - { - // Escape the backslash to avoid other escapes. - result += "\\\\"; - } - else - { - // Other characters will be parsed correctly. - result += *c; - } - } - result += "\""; - return result; -} - -//---------------------------------------------------------------------------- -cmLocalGenerator::FortranFormat -cmLocalGenerator::GetFortranFormat(const char* value) -{ - FortranFormat format = FortranFormatNone; - if(value && *value) - { - std::vector<std::string> fmt; - cmSystemTools::ExpandListArgument(value, fmt); - for(std::vector<std::string>::iterator fi = fmt.begin(); - fi != fmt.end(); ++fi) - { - if(*fi == "FIXED") - { - format = FortranFormatFixed; - } - if(*fi == "FREE") - { - format = FortranFormatFree; - } - } - } - return format; -} - -//---------------------------------------------------------------------------- std::string cmLocalGenerator::GetTargetDirectory(cmTarget const&) const { @@ -3481,7 +3005,7 @@ cmIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility() } } this->BackwardsCompatibility = CMake_VERSION_ENCODE(major, minor, patch); - this->BackwardsCompatibilityFinal = this->Configured; + this->BackwardsCompatibilityFinal = this->Makefile->IsConfigured(); } return this->BackwardsCompatibility; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 32b17f5..98f4d3a 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -14,6 +14,8 @@ #include "cmStandardIncludes.h" #include "cmState.h" +#include "cmake.h" +#include "cmOutputConverter.h" class cmMakefile; class cmGlobalGenerator; @@ -31,26 +33,19 @@ class cmCustomCommandGenerator; * platforms. This class should never be constructed directly. A * GlobalGenerator will create it and invoke the appropriate commands on it. */ -class cmLocalGenerator +class cmLocalGenerator : public cmOutputConverter { public: cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent, cmState::Snapshot snapshot); virtual ~cmLocalGenerator(); - /// @return whether we are processing the top CMakeLists.txt file. - bool IsRootMakefile() const; - /** * Generate the makefile for this directory. */ virtual void Generate() {} - /** - * Process the CMakeLists files for this directory to fill in the - * Makefile ivar - */ - virtual void Configure(); + virtual void ComputeHomeRelativeOutputPath() {} /** * Calls TraceVSDependencies() on all targets of this generator. @@ -60,11 +55,6 @@ public: virtual void AddHelperCommands() {} /** - * Perform any final calculations prior to generation - */ - void ConfigureFinalPass(); - - /** * Generate the install rules files in this directory. */ void GenerateInstallRules(); @@ -96,44 +86,6 @@ public: cmState* GetState() const; cmState::Snapshot GetStateSnapshot() const; - /** - * Convert something to something else. This is a centralized conversion - * routine used by the generators to handle relative paths and the like. - * The flags determine what is actually done. - * - * relative: treat the argument as a directory and convert it to make it - * relative or full or unchanged. If relative (HOME, START etc) then that - * specifies what it should be relative to. - * - * output: make the result suitable for output to a... - * - * optional: should any relative path operation be controlled by the rel - * path setting - */ - enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT }; - enum OutputFormat { UNCHANGED, MAKERULE, SHELL, WATCOMQUOTE, RESPONSE }; - std::string ConvertToOutputFormat(const std::string& source, - OutputFormat output); - std::string Convert(const std::string& remote, RelativeRoot local, - OutputFormat output = UNCHANGED, - bool optional = false); - std::string Convert(RelativeRoot remote, const std::string& local, - OutputFormat output = UNCHANGED, - bool optional = false); - - /** - * Get path for the specified relative root. - */ - const char* GetRelativeRootPath(RelativeRoot relroot); - - /** - * Convert the given path to an output path that is optionally - * relative based on the cache option CMAKE_USE_RELATIVE_PATHS. The - * remote path must use forward slashes and not already be escaped - * or quoted. - */ - std::string ConvertToOptionallyRelativeOutputPath(const std::string& remote); - ///! set/get the parent generator cmLocalGenerator* GetParent() const {return this->Parent;} @@ -194,6 +146,9 @@ public: void AppendFeatureOptions(std::string& flags, const std::string& lang, const char* feature); + const char* GetFeature(const std::string& feature, + const std::string& config); + /** \brief Get absolute path to dependency \a name * * Translate a dependency as given in CMake code to the name to @@ -209,17 +164,6 @@ public: bool GetRealDependency(const std::string& name, const std::string& config, std::string& dep); - ///! for existing files convert to output path and short path if spaces - std::string ConvertToOutputForExisting(const std::string& remote, - RelativeRoot local = START_OUTPUT, - OutputFormat format = SHELL); - - /** For existing path identified by RelativeRoot convert to output - path and short path if spaces. */ - std::string ConvertToOutputForExisting(RelativeRoot remote, - const std::string& local = "", - OutputFormat format = SHELL); - virtual std::string ConvertToIncludeReference(std::string const& path, OutputFormat format = SHELL, bool forceFullPaths = false); @@ -239,7 +183,7 @@ public: cmGeneratorTarget* target, const std::string& lang = "C", const std::string& config = "", - bool stripImplicitInclDirs = true); + bool stripImplicitInclDirs = true) const; void AddCompileOptions(std::string& flags, cmTarget* target, const std::string& lang, const std::string& config); void AddCompileDefinitions(std::set<std::string>& defines, @@ -291,40 +235,6 @@ public: const char* FilterPrefix; }; - /** Set whether to treat conversions to SHELL as a link script shell. */ - void SetLinkScriptShell(bool b) { this->LinkScriptShell = b; } - - /** Escape the given string to be used as a command line argument in - the native build system shell. Optionally allow the build - system to replace make variable references. Optionally adjust - escapes for the special case of passing to the native echo - command. */ - std::string EscapeForShell(const std::string& str, bool makeVars = false, - bool forEcho = false, - bool useWatcomQuote = false); - - /** Escape the given string as an argument in a CMake script. */ - static std::string EscapeForCMake(const std::string& str); - - enum FortranFormat - { - FortranFormatNone, - FortranFormatFixed, - FortranFormatFree - }; - FortranFormat GetFortranFormat(const char* value); - - /** - * Convert the given remote path to a relative path with respect to - * the given local path. The local path must be given in component - * form (see SystemTools::SplitPath) without a trailing slash. The - * remote path must use forward slashes and not already be escaped - * or quoted. - */ - std::string ConvertToRelativePath(const std::vector<std::string>& local, - const std::string& remote, - bool force=false); - /** * Get the relative path from the generator output directory to a * per-target support directory. @@ -392,8 +302,10 @@ public: bool IsMinGWMake() const; bool IsNMake() const; - void SetConfiguredCMP0014(bool configured); + void IssueMessage(cmake::MessageType t, std::string const& text) const; + + void ComputeObjectMaxPath(); protected: ///! put all the libraries for a target on into the given stream void OutputLinkLibraries(std::string& linkLibraries, @@ -439,7 +351,6 @@ protected: std::string& CreateSafeUniqueObjectFileName(const std::string& sin, std::string const& dir_max); - void ComputeObjectMaxPath(); virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); @@ -459,9 +370,6 @@ protected: std::set<cmTarget const*> WarnCMP0063; - bool LinkScriptShell; - bool UseRelativePaths; - bool Configured; bool EmitUniversalBinaryFlags; // Hack for ExpandRuleVariable until object-oriented version is @@ -471,10 +379,6 @@ protected: cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; private: - std::string ConvertToOutputForExistingCommon(const std::string& remote, - std::string const& result, - OutputFormat format); - void AddSharedFlags(std::string& flags, const std::string& lang, bool shared); bool GetShouldUseOldFlags(bool shared, const std::string &lang) const; diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index 870b9b9..8e498dd 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -37,7 +37,7 @@ void cmLocalGhsMultiGenerator::Generate() { continue; } - cmGhsMultiTargetGenerator tg(l->second->Target); + cmGhsMultiTargetGenerator tg(l->second); tg.Generate(); } } diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index c08c91f..4db36fc 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -41,6 +41,15 @@ cmLocalNinjaGenerator::~cmLocalNinjaGenerator() void cmLocalNinjaGenerator::Generate() { + // Compute the path to use when referencing the current output + // directory from the top output directory. + this->HomeRelativeOutputPath = + this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT); + if(this->HomeRelativeOutputPath == ".") + { + this->HomeRelativeOutputPath = ""; + } + this->SetConfigName(); this->WriteProcessedMakefile(this->GetBuildFileStream()); @@ -49,7 +58,7 @@ void cmLocalNinjaGenerator::Generate() #endif // We do that only once for the top CMakeLists.txt file. - if(this->IsRootMakefile()) + if(this->Makefile->IsRootMakefile()) { this->WriteBuildFileTop(); @@ -91,25 +100,6 @@ void cmLocalNinjaGenerator::Generate() this->WriteCustomCommandBuildStatements(); } -// Implemented in: -// cmLocalUnixMakefileGenerator3. -// Used in: -// Source/cmMakefile.cxx -// Source/cmGlobalGenerator.cxx -void cmLocalNinjaGenerator::Configure() -{ - // Compute the path to use when referencing the current output - // directory from the top output directory. - this->HomeRelativeOutputPath = - this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT); - if(this->HomeRelativeOutputPath == ".") - { - this->HomeRelativeOutputPath = ""; - } - this->cmLocalGenerator::Configure(); - -} - // TODO: Picked up from cmLocalUnixMakefileGenerator3. Refactor it. std::string cmLocalNinjaGenerator ::GetTargetDirectory(cmTarget const& target) const @@ -308,7 +298,7 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os) << "# Write statements declared in CMakeLists.txt:" << std::endl << "# " << this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE") << std::endl; - if(this->IsRootMakefile()) + if(this->Makefile->IsRootMakefile()) os << "# Which is the root file." << std::endl; cmGlobalNinjaGenerator::WriteDivider(os); os << std::endl; diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 7ae97de..ce966ff 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -38,8 +38,6 @@ public: virtual void Generate(); - virtual void Configure(); - virtual std::string GetTargetDirectory(cmTarget const& target) const; const cmGlobalNinjaGenerator* GetGlobalNinjaGenerator() const; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 3eea59b..e292ba7 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -98,24 +98,6 @@ cmLocalUnixMakefileGenerator3::~cmLocalUnixMakefileGenerator3() } //---------------------------------------------------------------------------- -void cmLocalUnixMakefileGenerator3::Configure() -{ - // Compute the path to use when referencing the current output - // directory from the top output directory. - this->HomeRelativeOutputPath = - this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT); - if(this->HomeRelativeOutputPath == ".") - { - this->HomeRelativeOutputPath = ""; - } - if(!this->HomeRelativeOutputPath.empty()) - { - this->HomeRelativeOutputPath += "/"; - } - this->cmLocalGenerator::Configure(); -} - -//---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::Generate() { // Store the configuration name that will be generated. @@ -169,6 +151,22 @@ void cmLocalUnixMakefileGenerator3::Generate() this->WriteDirectoryInformationFile(); } +void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath() +{ + // Compute the path to use when referencing the current output + // directory from the top output directory. + this->HomeRelativeOutputPath = + this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT); + if(this->HomeRelativeOutputPath == ".") + { + this->HomeRelativeOutputPath = ""; + } + if(!this->HomeRelativeOutputPath.empty()) + { + this->HomeRelativeOutputPath += "/"; + } +} + //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::ComputeObjectFilenames( std::map<cmSourceFile const*, std::string>& mapping, @@ -1259,7 +1257,7 @@ cmLocalUnixMakefileGenerator3 f != files.end(); ++f) { std::string fc = this->Convert(*f,START_OUTPUT,UNCHANGED); - fout << " " << cmLocalGenerator::EscapeForCMake(fc) << "\n"; + fout << " " << cmOutputConverter::EscapeForCMake(fc) << "\n"; } fout << ")\n"; } @@ -1845,7 +1843,6 @@ void cmLocalUnixMakefileGenerator3 std::vector<std::string> commands; // Write the all rule. - std::string dir; std::string recursiveTarget = this->Makefile->GetCurrentBinaryDirectory(); recursiveTarget += "/all"; @@ -2057,7 +2054,7 @@ void cmLocalUnixMakefileGenerator3 di != defines.end(); ++di) { cmakefileStream - << " " << cmLocalGenerator::EscapeForCMake(*di) << "\n"; + << " " << cmOutputConverter::EscapeForCMake(*di) << "\n"; } cmakefileStream << " )\n"; @@ -2111,7 +2108,7 @@ void cmLocalUnixMakefileGenerator3 tri != transformRules.end(); ++tri) { cmakefileStream << " " - << cmLocalGenerator::EscapeForCMake(*tri) << "\n"; + << cmOutputConverter::EscapeForCMake(*tri) << "\n"; } cmakefileStream << " )\n"; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 988d660..b097c95 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -39,11 +39,7 @@ public: cmState::Snapshot snapshot); virtual ~cmLocalUnixMakefileGenerator3(); - /** - * Process the CMakeLists files for this directory to fill in the - * Makefile ivar - */ - virtual void Configure(); + virtual void ComputeHomeRelativeOutputPath(); /** * Generate the makefile for this directory. @@ -153,9 +149,6 @@ public: void AddImplicitDepends(cmTarget const& tgt, const std::string& lang, const char* obj, const char* src); - void AppendGlobalTargetDepends(std::vector<std::string>& depends, - cmTarget& target); - // write the target rules for the local Makefile into the stream void WriteLocalAllRules(std::ostream& ruleFileStream); @@ -260,26 +253,10 @@ private: ImplicitDependTargetMap ImplicitDepends; - //========================================================================== - // Configuration settings. - int MakefileVariableSize; std::string ConfigurationName; - bool MakeCommandEscapeTargetTwice; - bool BorlandMakeCurlyHack; - //========================================================================== std::string HomeRelativeOutputPath; - /* Copy the setting of CMAKE_COLOR_MAKEFILE from the makefile at the - beginning of generation to avoid many duplicate lookups. */ - bool ColorMakefile; - - /* Copy the setting of CMAKE_SKIP_PREPROCESSED_SOURCE_RULES and - CMAKE_SKIP_ASSEMBLY_SOURCE_RULES at the beginning of generation to - avoid many duplicate lookups. */ - bool SkipPreprocessedSourceRules; - bool SkipAssemblySourceRules; - struct LocalObjectEntry { cmTarget* Target; @@ -308,6 +285,13 @@ private: /* does the work for each target */ std::map<std::string, std::string> MakeVariableMap; std::map<std::string, std::string> ShortMakeVariableMap; + + int MakefileVariableSize; + bool MakeCommandEscapeTargetTwice; + bool BorlandMakeCurlyHack; + bool ColorMakefile; + bool SkipPreprocessedSourceRules; + bool SkipAssemblySourceRules; }; #endif diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index ad6a020..9ded83a 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -107,10 +107,9 @@ void cmLocalVisualStudio10Generator cmVS10XMLParser parser; parser.ParseFile(path); - // if we can not find a GUID then create one + // if we can not find a GUID then we will generate one later if(parser.GUID.empty()) { - this->GlobalGenerator->CreateGUID(name); return; } diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index ad34857..a26a1dd 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -235,13 +235,10 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) comment += makefileIn; std::string args; args = "-H"; - args += this->Convert(this->Makefile->GetHomeDirectory(), - START_OUTPUT, UNCHANGED, true); + args += this->Makefile->GetHomeDirectory(); commandLine.push_back(args); args = "-B"; - args += - this->Convert(this->Makefile->GetHomeOutputDirectory(), - START_OUTPUT, UNCHANGED, true); + args += this->Makefile->GetHomeOutputDirectory(); commandLine.push_back(args); std::vector<std::string> const& listFiles = this->Makefile->GetListFiles(); @@ -498,7 +495,7 @@ void cmLocalVisualStudio6Generator // Tell MS-Dev what the source is. If the compiler knows how to // build it, then it will. fout << "SOURCE=" << - this->ConvertToOptionallyRelativeOutputPath(source.c_str()) << "\n\n"; + this->ConvertToOutputFormat(source.c_str(), SHELL) << "\n\n"; if(!depends.empty()) { // Write out the dependencies for the rule. @@ -507,7 +504,7 @@ void cmLocalVisualStudio6Generator d != depends.end(); ++d) { fout << "\\\n\t" << - this->ConvertToOptionallyRelativeOutputPath(d->c_str()); + this->ConvertToOutputFormat(d->c_str(), SHELL); } fout << "\n"; } @@ -663,7 +660,7 @@ cmLocalVisualStudio6Generator if(this->GetRealDependency(d->c_str(), config.c_str(), dep)) { fout << "\\\n\t" << - this->ConvertToOptionallyRelativeOutputPath(dep.c_str()); + this->ConvertToOutputFormat(dep.c_str(), SHELL); } } fout << "\n"; @@ -689,7 +686,7 @@ cmLocalVisualStudio6Generator ++o) { // Write a rule for every output generated by this command. - fout << this->ConvertToOptionallyRelativeOutputPath(o->c_str()) + fout << this->ConvertToOutputFormat(o->c_str(), SHELL) << " : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"\n\t"; fout << script.c_str() << "\n\n"; } @@ -906,7 +903,7 @@ cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target, for(i = includes.begin(); i != includes.end(); ++i) { std::string tmp = - this->ConvertToOptionallyRelativeOutputPath(i->c_str()); + this->ConvertToOutputFormat(i->c_str(), SHELL); if(useShortPath) { cmSystemTools::GetShortPath(tmp.c_str(), tmp); @@ -997,14 +994,14 @@ void cmLocalVisualStudio6Generator if(libPath.size()) { std::string lpath = - this->ConvertToOptionallyRelativeOutputPath(libPath.c_str()); + this->ConvertToOutputFormat(libPath.c_str(), SHELL); if(lpath.size() == 0) { lpath = "."; } std::string lpathIntDir = libPath + "$(INTDIR)"; lpathIntDir = - this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str()); + this->ConvertToOutputFormat(lpathIntDir.c_str(), SHELL); if(pathEmitted.insert(lpath).second) { libOptions += " /LIBPATH:"; @@ -1030,14 +1027,14 @@ void cmLocalVisualStudio6Generator if(exePath.size()) { std::string lpath = - this->ConvertToOptionallyRelativeOutputPath(exePath.c_str()); + this->ConvertToOutputFormat(exePath.c_str(), SHELL); if(lpath.size() == 0) { lpath = "."; } std::string lpathIntDir = exePath + "$(INTDIR)"; lpathIntDir = - this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str()); + this->ConvertToOutputFormat(lpathIntDir.c_str(), SHELL); if(pathEmitted.insert(lpath).second) { @@ -1071,14 +1068,14 @@ void cmLocalVisualStudio6Generator path += "/"; } std::string lpath = - this->ConvertToOptionallyRelativeOutputPath(path.c_str()); + this->ConvertToOutputFormat(path.c_str(), SHELL); if(lpath.size() == 0) { lpath = "."; } std::string lpathIntDir = path + "$(INTDIR)"; lpathIntDir = - this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str()); + this->ConvertToOutputFormat(lpathIntDir.c_str(), SHELL); if(pathEmitted.insert(lpath).second) { libOptions += " /LIBPATH:"; @@ -1142,9 +1139,9 @@ void cmLocalVisualStudio6Generator libDebug += ".lib"; } } - lib = this->ConvertToOptionallyRelativeOutputPath(lib.c_str()); + lib = this->ConvertToOutputFormat(lib.c_str(), SHELL); libDebug = - this->ConvertToOptionallyRelativeOutputPath(libDebug.c_str()); + this->ConvertToOutputFormat(libDebug.c_str(), SHELL); if (j->second == cmTarget::GENERAL) { @@ -1367,21 +1364,21 @@ void cmLocalVisualStudio6Generator { #ifdef CM_USE_OLD_VS6 outputDirOld = - removeQuotes(this->ConvertToOptionallyRelativeOutputPath - (target.GetDirectory().c_str())); + removeQuotes(this->ConvertToOutputFormat + (target.GetDirectory().c_str(), SHELL)); #endif outputDirDebug = - removeQuotes(this->ConvertToOptionallyRelativeOutputPath( - target.GetDirectory("Debug").c_str())); + removeQuotes(this->ConvertToOutputFormat( + target.GetDirectory("Debug").c_str(), SHELL)); outputDirRelease = - removeQuotes(this->ConvertToOptionallyRelativeOutputPath( - target.GetDirectory("Release").c_str())); + removeQuotes(this->ConvertToOutputFormat( + target.GetDirectory("Release").c_str(), SHELL)); outputDirMinSizeRel = - removeQuotes(this->ConvertToOptionallyRelativeOutputPath( - target.GetDirectory("MinSizeRel").c_str())); + removeQuotes(this->ConvertToOutputFormat( + target.GetDirectory("MinSizeRel").c_str(), SHELL)); outputDirRelWithDebInfo = - removeQuotes(this->ConvertToOptionallyRelativeOutputPath( - target.GetDirectory("RelWithDebInfo").c_str())); + removeQuotes(this->ConvertToOutputFormat( + target.GetDirectory("RelWithDebInfo").c_str(), SHELL)); } else if(target.GetType() == cmTarget::OBJECT_LIBRARY) { @@ -1449,15 +1446,13 @@ void cmLocalVisualStudio6Generator targetImplibFlagMinSizeRel = "/implib:"; targetImplibFlagRelWithDebInfo = "/implib:"; targetImplibFlagDebug += - this->ConvertToOptionallyRelativeOutputPath(fullPathImpDebug.c_str()); + this->ConvertToOutputFormat(fullPathImpDebug.c_str(), SHELL); targetImplibFlagRelease += - this->ConvertToOptionallyRelativeOutputPath(fullPathImpRelease.c_str()); + this->ConvertToOutputFormat(fullPathImpRelease.c_str(), SHELL); targetImplibFlagMinSizeRel += - this->ConvertToOptionallyRelativeOutputPath( - fullPathImpMinSizeRel.c_str()); + this->ConvertToOutputFormat(fullPathImpMinSizeRel.c_str(), SHELL); targetImplibFlagRelWithDebInfo += - this->ConvertToOptionallyRelativeOutputPath( - fullPathImpRelWithDebInfo.c_str()); + this->ConvertToOutputFormat(fullPathImpRelWithDebInfo.c_str(), SHELL); } #ifdef CM_USE_OLD_VS6 @@ -1669,12 +1664,12 @@ void cmLocalVisualStudio6Generator // to convert to output path for unix to win32 conversion cmSystemTools::ReplaceString (line, "LIBRARY_OUTPUT_PATH", - removeQuotes(this->ConvertToOptionallyRelativeOutputPath - (libPath.c_str())).c_str()); + removeQuotes(this->ConvertToOutputFormat + (libPath.c_str(), SHELL)).c_str()); cmSystemTools::ReplaceString (line, "EXECUTABLE_OUTPUT_PATH", - removeQuotes(this->ConvertToOptionallyRelativeOutputPath - (exePath.c_str())).c_str()); + removeQuotes(this->ConvertToOutputFormat + (exePath.c_str(), SHELL)).c_str()); #endif if(targetBuilds || target.GetType() == cmTarget::OBJECT_LIBRARY) @@ -1884,9 +1879,9 @@ void cmLocalVisualStudio6Generator } dir += "$(IntDir)"; options += "# ADD LINK32 /LIBPATH:"; - options += this->ConvertToOptionallyRelativeOutputPath(dir.c_str()); + options += this->ConvertToOutputFormat(dir.c_str(), SHELL); options += " /LIBPATH:"; - options += this->ConvertToOptionallyRelativeOutputPath(d->c_str()); + options += this->ConvertToOutputFormat(d->c_str(), SHELL); options += "\n"; } } @@ -1897,7 +1892,7 @@ void cmLocalVisualStudio6Generator if(l->IsPath) { options += - this->ConvertToOptionallyRelativeOutputPath(l->Value.c_str()); + this->ConvertToOutputFormat(l->Value.c_str(), SHELL); } else if (!l->Target || l->Target->GetType() != cmTarget::INTERFACE_LIBRARY) @@ -1933,7 +1928,7 @@ void cmLocalVisualStudio6Generator options += "# ADD "; options += tool; options += "32 "; - options += this->ConvertToOptionallyRelativeOutputPath(oi->c_str()); + options += this->ConvertToOutputFormat(oi->c_str(), SHELL); options += "\n"; } } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 9c031cf..dc3a16d 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -82,8 +82,6 @@ void cmLocalVisualStudio7Generator::AddHelperCommands() // Now create GUIDs for targets cmTargets &tgts = this->Makefile->GetTargets(); - cmGlobalVisualStudio7Generator* gg = - static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { if(l->second.GetType() == cmTarget::INTERFACE_LIBRARY) @@ -96,10 +94,6 @@ void cmLocalVisualStudio7Generator::AddHelperCommands() this->ReadAndStoreExternalGUID( l->second.GetName().c_str(), path); } - else - { - gg->CreateGUID(l->first.c_str()); - } } @@ -305,13 +299,10 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() comment += makefileIn; std::string args; args = "-H"; - args += this->Convert(this->Makefile->GetHomeDirectory(), - START_OUTPUT, UNCHANGED, true); + args += this->Makefile->GetHomeDirectory(); commandLine.push_back(args); args = "-B"; - args += - this->Convert(this->Makefile->GetHomeOutputDirectory(), - START_OUTPUT, UNCHANGED, true); + args += this->Makefile->GetHomeOutputDirectory(); commandLine.push_back(args); commandLine.push_back("--check-stamp-file"); std::string stampFilename = this->Convert(stampName.c_str(), FULL, @@ -1087,7 +1078,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, if(!this->ModuleDefinitionFile.empty()) { std::string defFile = - this->ConvertToOptionallyRelativeOutputPath(this->ModuleDefinitionFile); + this->ConvertToOutputFormat(this->ModuleDefinitionFile, SHELL); linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str()); } switch(target.GetType()) @@ -2234,7 +2225,7 @@ std::string cmLocalVisualStudio7Generator::EscapeForXML(const std::string& s) std::string cmLocalVisualStudio7Generator ::ConvertToXMLOutputPath(const char* path) { - std::string ret = this->ConvertToOptionallyRelativeOutputPath(path); + std::string ret = this->ConvertToOutputFormat(path, SHELL); cmSystemTools::ReplaceString(ret, "&", "&"); cmSystemTools::ReplaceString(ret, "\"", """); cmSystemTools::ReplaceString(ret, "<", "<"); @@ -2245,7 +2236,7 @@ std::string cmLocalVisualStudio7Generator std::string cmLocalVisualStudio7Generator ::ConvertToXMLOutputPathSingle(const char* path) { - std::string ret = this->ConvertToOptionallyRelativeOutputPath(path); + std::string ret = this->ConvertToOutputFormat(path, SHELL); cmSystemTools::ReplaceString(ret, "\"", ""); cmSystemTools::ReplaceString(ret, "&", "&"); cmSystemTools::ReplaceString(ret, "<", "<"); @@ -2312,12 +2303,9 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( { cmVS7XMLParser parser; parser.ParseFile(path); - // if we can not find a GUID then create one + // if we can not find a GUID then we will generate one later if(parser.GUID.size() == 0) { - cmGlobalVisualStudio7Generator* gg = - static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); - gg->CreateGUID(name); return; } std::string guidStoreName = name; diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 7ac4432..0b945b2 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -96,12 +96,8 @@ bool cmMacroHelperCommand::InvokeInitialPass return false; } - // Enforce matching logical blocks inside the macro. - cmMakefile::LexicalPushPop lexScope(this->Makefile); - - // Push a weak policy scope which restores the policies recorded at - // macro creation. - cmMakefile::PolicyPushPop polScope(this->Makefile, true, this->Policies); + cmMakefile::MacroPushPop macroScope(this->Makefile, + this->Policies); // set the value of argc std::ostringstream argcDefStream; @@ -126,10 +122,6 @@ bool cmMacroHelperCommand::InvokeInitialPass sprintf(argvName,"${ARGV%i}",j); argVs.push_back(argvName); } - if(!this->Functions.empty()) - { - this->FilePath = this->Functions[0].FilePath; - } // Invoke all the functions that were collected in the block. cmListFileFunction newLFF; // for each function @@ -147,10 +139,6 @@ bool cmMacroHelperCommand::InvokeInitialPass this->Functions[c].Arguments.begin(); k != this->Functions[c].Arguments.end(); ++k) { - // Set the FilePath on the arguments to match the function since it is - // not stored and the original values may be freed - k->FilePath = this->FilePath.c_str(); - cmListFileArgument arg; arg.Value = k->Value; if(k->Delim != cmListFileArgument::Bracket) @@ -181,7 +169,6 @@ bool cmMacroHelperCommand::InvokeInitialPass } } arg.Delim = k->Delim; - arg.FilePath = k->FilePath; arg.Line = k->Line; newLFF.Arguments.push_back(arg); } @@ -191,8 +178,7 @@ bool cmMacroHelperCommand::InvokeInitialPass { // The error message should have already included the call stack // so we do not need to report an error here. - lexScope.Quiet(); - polScope.Quiet(); + macroScope.Quiet(); inStatus.SetNestedError(true); return false; } @@ -230,6 +216,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmMacroHelperCommand *f = new cmMacroHelperCommand(); f->Args = this->Args; f->Functions = this->Functions; + f->FilePath = this->GetStartingContext().FilePath; mf.RecordPolicies(f->Policies); std::string newName = "_" + this->Args[0]; mf.GetState()->RenameCommand(this->Args[0], newName); @@ -259,7 +246,8 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf) if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endmacro")) { std::vector<std::string> expandedArguments; - mf.ExpandArguments(lff.Arguments, expandedArguments); + mf.ExpandArguments(lff.Arguments, expandedArguments, + this->GetStartingContext().FilePath.c_str()); // if the endmacro has arguments make sure they // match the arguments of the macro if ((expandedArguments.empty() || diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7c74a0f..a3ba134 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -105,7 +105,7 @@ public: ++it; if(it == this->VarStack.rend()) { - cmLocalGenerator* plg = mf->GetLocalGenerator()->GetParent(); + cmLocalGenerator* plg = mf->LocalGenerator->GetParent(); if(!plg) { return false; @@ -146,7 +146,7 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator) this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused(); this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars(); - this->GeneratingBuildSystem = false; + this->Configured = false; this->SuppressWatches = false; // Setup the default include file regular expression (match everything). @@ -213,8 +213,6 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator) this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$"); #endif - this->Properties.SetCMakeInstance(this->GetCMakeInstance()); - { const char* dir = this->GetCMakeInstance()->GetHomeDirectory(); this->AddDefinition("CMAKE_SOURCE_DIR", dir); @@ -266,8 +264,8 @@ void cmMakefile::IssueMessage(cmake::MessageType t, if(!this->GetCMakeInstance()->GetIsInTryCompile()) { - lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, - cmLocalGenerator::HOME); + cmOutputConverter converter(this->StateSnapshot); + lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME); } lfc.Line = 0; this->GetCMakeInstance()->IssueMessage(t, text, lfc); @@ -277,7 +275,21 @@ void cmMakefile::IssueMessage(cmake::MessageType t, //---------------------------------------------------------------------------- cmListFileBacktrace cmMakefile::GetBacktrace() const { - cmListFileBacktrace backtrace(this->GetLocalGenerator()); + cmListFileBacktrace backtrace(this->StateSnapshot); + for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin(); + i != this->CallStack.rend(); ++i) + { + backtrace.Append(*i->Context); + } + return backtrace; +} + +//---------------------------------------------------------------------------- +cmListFileBacktrace +cmMakefile::GetBacktrace(cmListFileContext const& lfc) const +{ + cmListFileBacktrace backtrace(this->StateSnapshot); + backtrace.Append(lfc); for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin(); i != this->CallStack.rend(); ++i) { @@ -296,7 +308,7 @@ cmListFileContext cmMakefile::GetExecutionContext() const void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const { std::ostringstream msg; - msg << lff.FilePath << "(" << lff.Line << "): "; + msg << this->GetExecutionFilePath() << "(" << lff.Line << "): "; msg << lff.Name << "("; for(std::vector<cmListFileArgument>::const_iterator i = lff.Arguments.begin(); i != lff.Arguments.end(); ++i) @@ -397,12 +409,12 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, class cmMakefile::IncludeScope { public: - IncludeScope(cmMakefile* mf, const char* fname, bool noPolicyScope); + IncludeScope(cmMakefile* mf, std::string const& filenametoread, + bool noPolicyScope); ~IncludeScope(); void Quiet() { this->ReportError = false; } private: cmMakefile* Makefile; - const char* File; bool NoPolicyScope; bool CheckCMP0011; bool ReportError; @@ -410,9 +422,10 @@ private: }; //---------------------------------------------------------------------------- -cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, const char* fname, +cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, + std::string const& filenametoread, bool noPolicyScope): - Makefile(mf), File(fname), NoPolicyScope(noPolicyScope), + Makefile(mf), NoPolicyScope(noPolicyScope), CheckCMP0011(false), ReportError(true) { if(!this->NoPolicyScope) @@ -446,6 +459,7 @@ cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, const char* fname, // The included file cannot pop our policy scope. this->Makefile->PushPolicyBarrier(); + this->Makefile->ListFileStack.push_back(filenametoread); } //---------------------------------------------------------------------------- @@ -475,6 +489,7 @@ cmMakefile::IncludeScope::~IncludeScope() this->EnforceCMP0011(); } } + this->Makefile->ListFileStack.pop_back(); } //---------------------------------------------------------------------------- @@ -489,7 +504,8 @@ void cmMakefile::IncludeScope::EnforceCMP0011() { std::ostringstream w; w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0011) << "\n" - << "The included script\n " << this->File << "\n" + << "The included script\n " + << this->Makefile->ListFileStack.back() << "\n" << "affects policy settings. " << "CMake is implying the NO_POLICY_SCOPE option for compatibility, " << "so the effects are applied to the including context."; @@ -501,7 +517,8 @@ void cmMakefile::IncludeScope::EnforceCMP0011() { std::ostringstream e; e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0011) << "\n" - << "The included script\n " << this->File << "\n" + << "The included script\n " + << this->Makefile->ListFileStack.back() << "\n" << "affects policy settings, so it requires this policy to be set."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); } @@ -515,37 +532,76 @@ void cmMakefile::IncludeScope::EnforceCMP0011() } } -bool cmMakefile::ProcessBuildsystemFile(const char* listfile) +bool cmMakefile::ProcessBuildsystemFile(const char* filename) { - this->AddDefinition("CMAKE_PARENT_LIST_FILE", listfile); + this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); std::string curSrc = this->GetCurrentSourceDirectory(); - return this->ReadListFile(listfile, true, - curSrc == this->GetHomeDirectory()); + + this->ListFileStack.push_back(filename); + + cmListFile listFile; + if (!listFile.ParseFile(filename, curSrc == this->GetHomeDirectory(), this)) + { + return false; + } + + this->PushPolicyBarrier(); + this->ReadListFile(listFile, filename); + this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); + this->EnforceDirectoryLevelRules(); + return true; } -bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope) +bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->GetDefinition("CMAKE_CURRENT_LIST_FILE")); - bool result = this->ReadListFile(listfile, noPolicyScope, false); - this->ListFileStack.pop_back(); - return result; + std::string filenametoread = + cmSystemTools::CollapseFullPath(filename, + this->GetCurrentSourceDirectory()); + + IncludeScope incScope(this, filenametoread, noPolicyScope); + + cmListFile listFile; + if (!listFile.ParseFile(filenametoread.c_str(), false, this)) + { + incScope.Quiet(); + return false; + } + this->ReadListFile(listFile, filenametoread); + if(cmSystemTools::GetFatalErrorOccured()) + { + incScope.Quiet(); + } + return true; } -bool cmMakefile::ReadListFile(const char* listfile) +bool cmMakefile::ReadListFile(const char* filename) { - bool result = this->ReadListFile(listfile, true, false); + std::string filenametoread = + cmSystemTools::CollapseFullPath(filename, + this->GetCurrentSourceDirectory()); + + this->ListFileStack.push_back(filenametoread); + + cmListFile listFile; + if (!listFile.ParseFile(filenametoread.c_str(), false, this)) + { + return false; + } + + this->PushPolicyBarrier(); + this->ReadListFile(listFile, filenametoread); + this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); this->ListFileStack.pop_back(); - return result; + return true; } -bool cmMakefile::ReadListFile(const char* listfile, - bool noPolicyScope, - bool requireProjectCommand) +void cmMakefile::ReadListFile(cmListFile const& listFile, + std::string const& filenametoread) { - std::string filenametoread = - cmSystemTools::CollapseFullPath(listfile, - this->GetCurrentSourceDirectory()); + // add this list file to the list of dependencies + this->ListFiles.push_back(filenametoread); std::string currentParentFile = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); @@ -560,55 +616,19 @@ bool cmMakefile::ReadListFile(const char* listfile, this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - this->ListFileStack.push_back(filenametoread); - - bool res = this->ReadListFileInternal(filenametoread.c_str(), - noPolicyScope, requireProjectCommand); - - this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); - this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str()); - this->AddDefinition("CMAKE_CURRENT_LIST_DIR", - cmSystemTools::GetFilenamePath(currentFile).c_str()); - this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - - if (res) - { - this->CheckForUnusedVariables(); - } - - return res; -} - -bool cmMakefile::ReadListFileInternal(const char* filenametoread, - bool noPolicyScope, - bool requireProjectCommand) -{ - cmListFile cacheFile; - if( !cacheFile.ParseFile(filenametoread, requireProjectCommand, this) ) - { - return false; - } - // add this list file to the list of dependencies - this->ListFiles.push_back( filenametoread); - // Enforce balanced blocks (if/endif, function/endfunction, etc.). - { LexicalPushPop lexScope(this); - IncludeScope incScope(this, filenametoread, noPolicyScope); // Run the parsed commands. - const size_t numberFunctions = cacheFile.Functions.size(); + const size_t numberFunctions = listFile.Functions.size(); for(size_t i =0; i < numberFunctions; ++i) { cmExecutionStatus status; - this->ExecuteCommand(cacheFile.Functions[i],status); + this->ExecuteCommand(listFile.Functions[i],status); if(cmSystemTools::GetFatalErrorOccured()) { // Exit early due to error. lexScope.Quiet(); - incScope.Quiet(); break; } if(status.GetReturnInvoked()) @@ -617,16 +637,15 @@ bool cmMakefile::ReadListFileInternal(const char* filenametoread, break; } } - } - - // If this is the directory-level CMakeLists.txt file then perform - // some extra checks. - if(this->ListFileStack.size() == 1) - { - this->EnforceDirectoryLevelRules(); - } + this->CheckForUnusedVariables(); - return true; + this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); + this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str()); + this->AddDefinition("CMAKE_CURRENT_LIST_DIR", + cmSystemTools::GetFilenamePath(currentFile).c_str()); + this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); + this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); + this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); } //---------------------------------------------------------------------------- @@ -1476,10 +1495,8 @@ void cmMakefile::AddLinkDirectory(const std::string& dir) } } -void cmMakefile::InitializeFromParent() +void cmMakefile::InitializeFromParent(cmMakefile* parent) { - cmMakefile *parent = this->LocalGenerator->GetParent()->GetMakefile(); - // Initialize definitions with the closure of the parent scope. this->Internal->InitializeDefinitions(parent); @@ -1553,10 +1570,123 @@ void cmMakefile::InitializeFromParent() this->ImportedTargets = parent->ImportedTargets; } -void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) +void cmMakefile::PushFunctionScope(const cmPolicies::PolicyMap& pm) +{ + this->Internal->PushDefinitions(); + + this->PushLoopBlockBarrier(); + +#if defined(CMAKE_BUILD_WITH_CMAKE) + this->GetGlobalGenerator()->GetFileLockPool().PushFunctionScope(); +#endif + + this->PushFunctionBlockerBarrier(); + + this->PushPolicy(true, pm); + this->PushPolicyBarrier(); +} + +void cmMakefile::PopFunctionScope(bool reportError) +{ + this->PopPolicyBarrier(reportError); + this->PopPolicy(); + + this->PopFunctionBlockerBarrier(reportError); + +#if defined(CMAKE_BUILD_WITH_CMAKE) + this->GetGlobalGenerator()->GetFileLockPool().PopFunctionScope(); +#endif + + this->PopLoopBlockBarrier(); + + this->CheckForUnusedVariables(); + + this->Internal->PopDefinitions(); +} + +void cmMakefile::PushMacroScope(const cmPolicies::PolicyMap& pm) { - lg2->GetMakefile()->InitializeFromParent(); - std::string currentStart = lg2->GetMakefile()->GetCurrentSourceDirectory(); + this->PushFunctionBlockerBarrier(); + + this->PushPolicy(true, pm); + this->PushPolicyBarrier(); +} + +void cmMakefile::PopMacroScope(bool reportError) +{ + this->PopPolicyBarrier(reportError); + this->PopPolicy(); + + this->PopFunctionBlockerBarrier(reportError); +} + +bool cmMakefile::IsRootMakefile() const +{ + return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid(); +} + +//---------------------------------------------------------------------------- +class cmMakefileCurrent +{ + cmGlobalGenerator* GG; + cmMakefile* MF; + cmState::Snapshot Snapshot; +public: + cmMakefileCurrent(cmMakefile* mf) + { + this->GG = mf->GetGlobalGenerator(); + this->MF = this->GG->GetCurrentMakefile(); + this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot(); + this->GG->GetCMakeInstance()->SetCurrentSnapshot( + this->GG->GetCMakeInstance()->GetCurrentSnapshot()); + this->GG->SetCurrentMakefile(mf); +#if defined(CMAKE_BUILD_WITH_CMAKE) + this->GG->GetFileLockPool().PushFileScope(); +#endif + } + ~cmMakefileCurrent() + { +#if defined(CMAKE_BUILD_WITH_CMAKE) + this->GG->GetFileLockPool().PopFileScope(); +#endif + this->GG->SetCurrentMakefile(this->MF); + this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); + } +}; + +//---------------------------------------------------------------------------- +void cmMakefile::Configure() +{ + cmMakefileCurrent cmf(this); + + // make sure the CMakeFiles dir is there + std::string filesDir = this->StateSnapshot.GetCurrentBinaryDirectory(); + filesDir += cmake::GetCMakeFilesDirectory(); + cmSystemTools::MakeDirectory(filesDir.c_str()); + + std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory(); + currentStart += "/CMakeLists.txt"; + assert(cmSystemTools::FileExists(currentStart.c_str(), true)); + this->ProcessBuildsystemFile(currentStart.c_str()); + + // at the end handle any old style subdirs + std::vector<cmMakefile*> subdirs = this->UnConfiguredDirectories; + + // for each subdir recurse + std::vector<cmMakefile*>::iterator sdi = subdirs.begin(); + for (; sdi != subdirs.end(); ++sdi) + { + this->ConfigureSubDirectory(*sdi); + } + + this->AddCMakeDependFilesFromUser(); + this->SetConfigured(); +} + +void cmMakefile::ConfigureSubDirectory(cmMakefile *mf) +{ + mf->InitializeFromParent(this); + std::string currentStart = mf->GetCurrentSourceDirectory(); if (this->GetCMakeInstance()->GetDebugOutput()) { std::string msg=" Entering "; @@ -1594,11 +1724,12 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) // NEW behavior prints the error. this->IssueMessage(cmake::FATAL_ERROR, e.str()); } - lg2->SetConfiguredCMP0014(true); + mf->SetConfigured(); return; } // finally configure the subdir - lg2->Configure(); + mf->Configure(); + if (this->GetCMakeInstance()->GetDebugOutput()) { std::string msg=" Returning to "; @@ -1619,24 +1750,30 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, } cmState::Snapshot newSnapshot = this->GetState() - ->CreateSnapshot(this->StateSnapshot); + ->CreateBuildsystemDirectorySnapshot(this->StateSnapshot); // create a new local generator and set its parent cmLocalGenerator *lg2 = this->GetGlobalGenerator() ->MakeLocalGenerator(newSnapshot, this->LocalGenerator); this->GetGlobalGenerator()->AddLocalGenerator(lg2); + cmMakefile* subMf = lg2->GetMakefile(); + // set the subdirs start dirs - lg2->GetMakefile()->SetCurrentSourceDirectory(srcPath); - lg2->GetMakefile()->SetCurrentBinaryDirectory(binPath); + subMf->SetCurrentSourceDirectory(srcPath); + subMf->SetCurrentBinaryDirectory(binPath); if(excludeFromAll) { - lg2->GetMakefile()->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); + subMf->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } if (immediate) { - this->ConfigureSubDirectory(lg2); + this->ConfigureSubDirectory(subMf); + } + else + { + this->UnConfiguredDirectories.push_back(subMf); } } @@ -1843,8 +1980,8 @@ void cmMakefile::LogUnused(const char* reason, lfc.FilePath = path; lfc.Line = 0; } - lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, - cmLocalGenerator::HOME); + cmOutputConverter converter(this->StateSnapshot); + lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME); if (this->CheckSystemVars || cmSystemTools::IsSubDirectory(path, @@ -2116,25 +2253,10 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name, return; } // build the whole source group path - const char* fullname = sg->GetFullName(); - cmGlobalGenerator* gg = this->GetGlobalGenerator(); - if(strlen(fullname)) - { - std::string guidName = "SG_Filter_"; - guidName += fullname; - gg->CreateGUID(guidName); - } for(++i; i<=lastElement; ++i) { sg->AddChild(cmSourceGroup(name[i].c_str(), 0, sg->GetFullName())); sg = sg->LookupChild(name[i].c_str()); - fullname = sg->GetFullName(); - if(strlen(fullname)) - { - std::string guidName = "SG_Filter_"; - guidName += fullname; - gg->CreateGUID(guidName); - } } sg->SetGroupRegex(regex); @@ -2390,18 +2512,11 @@ const char* cmMakefile::GetSafeDefinition(const std::string& def) const return ret; } -std::vector<std::string> cmMakefile -::GetDefinitions(int cacheonly /* = 0 */) const +std::vector<std::string> cmMakefile::GetDefinitions() const { - std::vector<std::string> res; - if ( !cacheonly ) - { - res = this->Internal->ClosureKeys(); - } - std::vector<std::string> cacheKeys = - this->GetState()->GetCacheEntryKeys(); + std::vector<std::string> res = this->Internal->ClosureKeys(); + std::vector<std::string> cacheKeys = this->GetState()->GetCacheEntryKeys(); res.insert(res.end(), cacheKeys.begin(), cacheKeys.end()); - std::sort(res.begin(), res.end()); return res; } @@ -2763,8 +2878,9 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( { std::ostringstream msg; cmListFileContext lfc; - lfc.FilePath = this->LocalGenerator - ->Convert(filename, cmLocalGenerator::HOME); + cmOutputConverter converter(this->StateSnapshot); + lfc.FilePath = + converter.Convert(filename, cmOutputConverter::HOME); lfc.Line = line; msg << "uninitialized variable \'" << lookup << "\'"; this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, @@ -3163,7 +3279,6 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError) this->FunctionBlockerBarriers.back(); while(this->FunctionBlockers.size() > barrier) { - cmMakefile::LoopBlockPop loopBlockPop(this); cmsys::auto_ptr<cmFunctionBlocker> fb(this->FunctionBlockers.back()); this->FunctionBlockers.pop_back(); if(reportError) @@ -3215,11 +3330,25 @@ bool cmMakefile::IsLoopBlock() const return !this->LoopBlockCounter.empty() && this->LoopBlockCounter.top() > 0; } +std::string cmMakefile::GetExecutionFilePath() const +{ + if (this->CallStack.empty()) + { + return std::string(); + } + return this->CallStack.back().Context->FilePath; +} + //---------------------------------------------------------------------------- bool cmMakefile::ExpandArguments( std::vector<cmListFileArgument> const& inArgs, - std::vector<std::string>& outArgs) const + std::vector<std::string>& outArgs, const char* filename) const { + std::string efp = this->GetExecutionFilePath(); + if (!filename) + { + filename = efp.c_str(); + } std::vector<cmListFileArgument>::const_iterator i; std::string value; outArgs.reserve(inArgs.size()); @@ -3234,8 +3363,7 @@ bool cmMakefile::ExpandArguments( // Expand the variables in the argument. value = i->Value; this->ExpandVariablesInString(value, false, false, false, - i->FilePath, i->Line, - false, false); + filename, i->Line, false, false); // If the argument is quoted, it should be one argument. // Otherwise, it may be a list of arguments. @@ -3254,8 +3382,13 @@ bool cmMakefile::ExpandArguments( //---------------------------------------------------------------------------- bool cmMakefile::ExpandArguments( std::vector<cmListFileArgument> const& inArgs, - std::vector<cmExpandedCommandArgument>& outArgs) const + std::vector<cmExpandedCommandArgument>& outArgs, const char* filename) const { + std::string efp = this->GetExecutionFilePath(); + if (!filename) + { + filename = efp.c_str(); + } std::vector<cmListFileArgument>::const_iterator i; std::string value; outArgs.reserve(inArgs.size()); @@ -3270,8 +3403,7 @@ bool cmMakefile::ExpandArguments( // Expand the variables in the argument. value = i->Value; this->ExpandVariablesInString(value, false, false, false, - i->FilePath, i->Line, - false, false); + filename, i->Line, false, false); // If the argument is quoted, it should be one argument. // Otherwise, it may be a list of arguments. @@ -3982,7 +4114,7 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) } } - this->Properties.SetProperty(prop,value,cmProperty::DIRECTORY); + this->Properties.SetProperty(prop, value); } void cmMakefile::AppendProperty(const std::string& prop, @@ -4022,23 +4154,26 @@ void cmMakefile::AppendProperty(const std::string& prop, return; } - this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString); + this->Properties.AppendProperty(prop, value, asString); } const char *cmMakefile::GetProperty(const std::string& prop) const { - return this->GetProperty(prop, cmProperty::DIRECTORY); + const bool chain = this->GetState()-> + IsPropertyChained(prop, cmProperty::DIRECTORY); + return this->GetProperty(prop, chain); } const char *cmMakefile::GetProperty(const std::string& prop, - cmProperty::ScopeType scope) const + bool chain) const { // watch for specific properties static std::string output; output = ""; if (prop == "PARENT_DIRECTORY") { - cmState::Snapshot parent = this->StateSnapshot.GetParent(); + cmState::Snapshot parent = + this->StateSnapshot.GetBuildsystemDirectoryParent(); if(parent.IsValid()) { return parent.GetCurrentSourceDirectory(); @@ -4055,36 +4190,20 @@ const char *cmMakefile::GetProperty(const std::string& prop, output = cmJoin(this->ListFileStack, ";"); return output.c_str(); } - else if (prop == "VARIABLES" || prop == "CACHE_VARIABLES") + else if ( prop == "CACHE_VARIABLES" ) { - int cacheonly = 0; - if ( prop == "CACHE_VARIABLES" ) - { - cacheonly = 1; - } - output = cmJoin(this->GetDefinitions(cacheonly), ";"); + output = cmJoin(this->GetState()->GetCacheEntryKeys(), ";"); return output.c_str(); } - else if (prop == "MACROS") + else if (prop == "VARIABLES") { - this->GetListOfMacros(output); + output = cmJoin(this->GetDefinitions(), ";"); return output.c_str(); } - else if (prop == "DEFINITIONS") + else if (prop == "MACROS") { - switch(this->GetPolicyStatus(cmPolicies::CMP0059)) - { - case cmPolicies::WARN: - this->IssueMessage(cmake::AUTHOR_WARNING, cmPolicies:: - GetPolicyWarning(cmPolicies::CMP0059)); - case cmPolicies::OLD: - output += this->DefineFlagsOrig; - return output.c_str(); - case cmPolicies::NEW: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - break; - } + this->GetListOfMacros(output); + return output.c_str(); } else if (prop == "LINK_DIRECTORIES") { @@ -4134,15 +4253,13 @@ const char *cmMakefile::GetProperty(const std::string& prop, return output.c_str(); } - bool chain = false; - const char *retVal = - this->Properties.GetPropertyValue(prop, scope, chain); - if (chain) + const char *retVal = this->Properties.GetPropertyValue(prop); + if (!retVal && chain) { if(this->LocalGenerator->GetParent()) { return this->LocalGenerator->GetParent()->GetMakefile()-> - GetProperty(prop, scope); + GetProperty(prop, chain); } return this->GetState()->GetGlobalProperty(prop); } @@ -4155,33 +4272,6 @@ bool cmMakefile::GetPropertyAsBool(const std::string& prop) const return cmSystemTools::IsOn(this->GetProperty(prop)); } -//---------------------------------------------------------------------------- -const char* cmMakefile::GetFeature(const std::string& feature, - const std::string& config) -{ - // TODO: Define accumulation policy for features (prepend, append, replace). - // Currently we always replace. - if(!config.empty()) - { - std::string featureConfig = feature; - featureConfig += "_"; - featureConfig += cmSystemTools::UpperCase(config); - if(const char* value = this->GetProperty(featureConfig)) - { - return value; - } - } - if(const char* value = this->GetProperty(feature)) - { - return value; - } - if(cmLocalGenerator* parent = this->LocalGenerator->GetParent()) - { - return parent->GetMakefile()->GetFeature(feature, config); - } - return 0; -} - cmTarget* cmMakefile::FindTarget(const std::string& name, bool excludeAliases) const { @@ -4597,6 +4687,16 @@ void cmMakefile::StoreMatches(cmsys::RegularExpression& re) this->MarkVariableAsUsed(nMatchesVariable); } +cmState::Snapshot cmMakefile::GetStateSnapshot() const +{ + return this->StateSnapshot; +} + +const char* cmMakefile::GetDefineFlagsCMP0059() const +{ + return this->DefineFlagsOrig.c_str(); +} + //---------------------------------------------------------------------------- cmPolicies::PolicyStatus cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const @@ -5358,3 +5458,41 @@ AddRequiredTargetCFeature(cmTarget *target, const std::string& feature) const } return true; } + + +cmMakefile::FunctionPushPop::FunctionPushPop(cmMakefile* mf, + cmPolicies::PolicyMap const& pm) + : Makefile(mf), ReportError(true) +{ + this->Makefile->PushFunctionScope(pm); +} + +cmMakefile::FunctionPushPop::~FunctionPushPop() +{ + this->Makefile->PopFunctionScope(this->ReportError); +} + + +cmMakefile::MacroPushPop::MacroPushPop(cmMakefile* mf, + const cmPolicies::PolicyMap& pm) + : Makefile(mf), ReportError(true) +{ + this->Makefile->PushMacroScope(pm); +} + +cmMakefile::MacroPushPop::~MacroPushPop() +{ + this->Makefile->PopMacroScope(this->ReportError); +} + +cmMakefileCall::cmMakefileCall(cmMakefile* mf, const cmListFileContext& lfc, + cmExecutionStatus& status): Makefile(mf) +{ + cmMakefile::CallStackEntry entry = {&lfc, &status}; + this->Makefile->CallStack.push_back(entry); +} + +cmMakefileCall::~cmMakefileCall() +{ + this->Makefile->CallStack.pop_back(); +} diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index efd73a1..85f117b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -14,7 +14,6 @@ #include "cmExecutionStatus.h" #include "cmListFileCache.h" -#include "cmPolicies.h" #include "cmPropertyMap.h" #include "cmSystemTools.h" #include "cmTarget.h" @@ -80,17 +79,20 @@ public: */ ~cmMakefile(); - bool ReadListFile(const char* listfile); + bool ReadListFile(const char* filename); - bool ReadDependentFile(const char* listfile, bool noPolicyScope = true); + bool ReadDependentFile(const char* filename, bool noPolicyScope = true); - bool ProcessBuildsystemFile(const char* listfile); + bool ProcessBuildsystemFile(const char* filename); /** * Add a function blocker to this makefile */ void AddFunctionBlocker(cmFunctionBlocker* fb); + /// @return whether we are processing the top CMakeLists.txt file. + bool IsRootMakefile() const; + /** * Remove the function blocker whose scope ends with the given command. * This returns ownership of the function blocker object. @@ -111,15 +113,6 @@ public: }; friend class LexicalPushPop; - class LoopBlockPop - { - public: - LoopBlockPop(cmMakefile* mf) { this->Makefile = mf; } - ~LoopBlockPop() { this->Makefile->PopLoopBlock(); } - private: - cmMakefile* Makefile; - }; - /** * Try running cmake and building a file. This is used for dynalically * loaded commands, not as part of the usual build process. @@ -270,10 +263,12 @@ public: bool excludeFromAll, bool immediate); + void Configure(); + /** * Configure a subdirectory */ - void ConfigureSubDirectory(cmLocalGenerator *); + void ConfigureSubDirectory(cmMakefile* mf); /** * Add an include directory to the build. @@ -372,13 +367,6 @@ public: friend class PolicyPushPop; /** - * Get the Policies Instance - */ - cmPolicies *GetPolicies() const; - - mutable std::set<cmListFileContext> CMP0054ReportedIds; - - /** * Determine if the given context, name pair has already been reported * in context of CMP0054. */ @@ -515,7 +503,7 @@ public: * cacheonly is specified and is greater than 0, then only cache * variables will be listed. */ - std::vector<std::string> GetDefinitions(int cacheonly=0) const; + std::vector<std::string> GetDefinitions() const; /** * Test a boolean variable to see if it is true or false. @@ -572,6 +560,7 @@ public: * Get the current context backtrace. */ cmListFileBacktrace GetBacktrace() const; + cmListFileBacktrace GetBacktrace(cmListFileContext const& lfc) const; cmListFileContext GetExecutionContext() const; /** @@ -667,10 +656,12 @@ public: * variable replacement and list expansion. */ bool ExpandArguments(std::vector<cmListFileArgument> const& inArgs, - std::vector<std::string>& outArgs) const; + std::vector<std::string>& outArgs, + const char* filename = 0) const; bool ExpandArguments(std::vector<cmListFileArgument> const& inArgs, - std::vector<cmExpandedCommandArgument>& outArgs) const; + std::vector<cmExpandedCommandArgument>& outArgs, + const char* filename = 0) const; /** * Get the instance @@ -720,18 +711,14 @@ public: void AppendProperty(const std::string& prop, const char *value, bool asString=false); const char *GetProperty(const std::string& prop) const; - const char *GetProperty(const std::string& prop, - cmProperty::ScopeType scope) const; + const char *GetProperty(const std::string& prop, bool chain) const; bool GetPropertyAsBool(const std::string& prop) const; - const char* GetFeature(const std::string& feature, - const std::string& config); - // Get the properties cmPropertyMap &GetProperties() { return this->Properties; } ///! Initialize a makefile from its parent - void InitializeFromParent(); + void InitializeFromParent(cmMakefile* parent); void AddInstallGenerator(cmInstallGenerator* g) { if(g) this->InstallGenerators.push_back(g); } @@ -743,7 +730,36 @@ public: const std::vector<cmTestGenerator*>& GetTestGenerators() const { return this->TestGenerators; } - // push and pop variable scopes + class FunctionPushPop + { + public: + FunctionPushPop(cmMakefile* mf, + cmPolicies::PolicyMap const& pm); + ~FunctionPushPop(); + + void Quiet() { this->ReportError = false; } + private: + cmMakefile* Makefile; + bool ReportError; + }; + + class MacroPushPop + { + public: + MacroPushPop(cmMakefile* mf, + cmPolicies::PolicyMap const& pm); + ~MacroPushPop(); + + void Quiet() { this->ReportError = false; } + private: + cmMakefile* Makefile; + bool ReportError; + }; + + void PushFunctionScope(cmPolicies::PolicyMap const& pm); + void PopFunctionScope(bool reportError); + void PushMacroScope(cmPolicies::PolicyMap const& pm); + void PopMacroScope(bool reportError); void PushScope(); void PopScope(); void RaiseScope(const std::string& var, const char *value); @@ -781,8 +797,8 @@ public: return this->CompileDefinitionsEntries; } - bool IsGeneratingBuildSystem() const { return this->GeneratingBuildSystem; } - void SetGeneratingBuildSystem(){ this->GeneratingBuildSystem = true; } + bool IsConfigured() const { return this->Configured; } + void SetConfigured(){ this->Configured = true; } void AddQtUiFileWithOptions(cmSourceFile *sf); std::vector<cmSourceFile*> GetQtUiFilesWithOptions() const; @@ -816,6 +832,12 @@ public: void ClearMatches(); void StoreMatches(cmsys::RegularExpression& re); + cmState::Snapshot GetStateSnapshot() const; + + const char* GetDefineFlagsCMP0059() const; + + std::string GetExecutionFilePath() const; + protected: // add link libraries and directories to the target void AddGlobalLinkInformation(const std::string& name, cmTarget& target); @@ -823,6 +845,8 @@ protected: // Check for a an unused variable void LogUnused(const char* reason, const std::string& name) const; + mutable std::set<cmListFileContext> CMP0054ReportedIds; + std::string ProjectName; // project name // libraries, classes, and executables @@ -888,13 +912,8 @@ private: cmState::Snapshot StateSnapshot; - bool ReadListFile(const char* listfile, - bool noPolicyScope, - bool requireProjectCommand); - - bool ReadListFileInternal(const char* filenametoread, - bool noPolicyScope, - bool requireProjectCommand); + void ReadListFile(cmListFile const& listFile, + const std::string& filenametoread); bool ParseDefineFlag(std::string const& definition, bool remove); @@ -920,11 +939,9 @@ private: mutable cmsys::RegularExpression cmAtVarRegex; mutable cmsys::RegularExpression cmNamedCurly; - cmPropertyMap Properties; + std::vector<cmMakefile*> UnConfiguredDirectories; - // Unused variable flags - bool WarnUnused; - bool CheckSystemVars; + cmPropertyMap Properties; // stack of list files being read std::vector<std::string> ListFileStack; @@ -967,8 +984,6 @@ private: cmPolicies::PolicyStatus GetPolicyStatusInternal(cmPolicies::PolicyID id) const; - bool CheckCMP0000; - // Enforce rules about CMakeLists.txt files. void EnforceDirectoryLevelRules() const; @@ -994,7 +1009,6 @@ private: long line, bool removeEmpty, bool replaceAt) const; - bool GeneratingBuildSystem; /** * Old version of GetSourceFileWithOutput(const std::string&) kept for * backward-compatibility. It implements a linear search and support @@ -1040,6 +1054,11 @@ private: void CheckForUnusedVariables() const; + // Unused variable flags + bool WarnUnused; + bool CheckSystemVars; + bool CheckCMP0000; + bool Configured; mutable bool SuppressWatches; }; @@ -1050,15 +1069,8 @@ class cmMakefileCall public: cmMakefileCall(cmMakefile* mf, cmListFileContext const& lfc, - cmExecutionStatus& status): Makefile(mf) - { - cmMakefile::CallStackEntry entry = {&lfc, &status}; - this->Makefile->CallStack.push_back(entry); - } - ~cmMakefileCall() - { - this->Makefile->CallStack.pop_back(); - } + cmExecutionStatus& status); + ~cmMakefileCall(); private: cmMakefile* Makefile; }; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 37b297e..416063f 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -22,7 +22,7 @@ //---------------------------------------------------------------------------- cmMakefileExecutableTargetGenerator ::cmMakefileExecutableTargetGenerator(cmGeneratorTarget* target): - cmMakefileTargetGenerator(target->Target) + cmMakefileTargetGenerator(target) { this->CustomCommandDriver = OnDepends; this->Target->GetExecutableNames( diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 450f573..660027c 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -22,7 +22,7 @@ //---------------------------------------------------------------------------- cmMakefileLibraryTargetGenerator ::cmMakefileLibraryTargetGenerator(cmGeneratorTarget* target): - cmMakefileTargetGenerator(target->Target) + cmMakefileTargetGenerator(target) { this->CustomCommandDriver = OnDepends; if (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 7b88bc7..09fad5c 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -32,7 +32,7 @@ #include <ctype.h> -cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmTarget* target) +cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) : OSXBundleGenerator(0) , MacOSXContentGenerator(0) { @@ -41,16 +41,15 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmTarget* target) this->FlagFileStream = 0; this->CustomCommandDriver = OnBuild; this->FortranModuleDirectoryComputed = false; - this->Target = target; + this->Target = target->Target; this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = - static_cast<cmLocalUnixMakefileGenerator3*>( - this->Makefile->GetLocalGenerator()); + static_cast<cmLocalUnixMakefileGenerator3*>(target->GetLocalGenerator()); this->ConfigName = this->LocalGenerator->ConfigurationName.c_str(); this->GlobalGenerator = static_cast<cmGlobalUnixMakefileGenerator3*>( this->LocalGenerator->GetGlobalGenerator()); - this->GeneratorTarget = this->GlobalGenerator->GetGeneratorTarget(target); + this->GeneratorTarget = target; cmake* cm = this->GlobalGenerator->GetCMakeInstance(); this->NoRuleMessages = false; if(const char* ruleStatus = cm->GetState() @@ -614,13 +613,7 @@ cmMakefileTargetGenerator } // Get the output paths for source and object files. - std::string sourceFile = source.GetFullPath(); - if(this->LocalGenerator->UseRelativePaths) - { - sourceFile = this->Convert(sourceFile, - cmLocalGenerator::START_OUTPUT); - } - sourceFile = this->Convert(sourceFile, + std::string sourceFile = this->Convert(source.GetFullPath(), cmLocalGenerator::NONE, cmLocalGenerator::SHELL); @@ -775,6 +768,25 @@ cmMakefileTargetGenerator } } + // Maybe insert a compiler launcher like ccache or distcc + if (!compileCommands.empty() && (lang == "C" || lang == "CXX")) + { + std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER"; + const char *clauncher = this->Target->GetProperty(clauncher_prop); + if (clauncher && *clauncher) + { + std::vector<std::string> launcher_cmd; + cmSystemTools::ExpandListArgument(clauncher, launcher_cmd, true); + for (std::vector<std::string>::iterator i = launcher_cmd.begin(), + e = launcher_cmd.end(); i != e; ++i) + { + *i = this->LocalGenerator->EscapeForShell(*i); + } + std::string const& run_launcher = cmJoin(launcher_cmd, " ") + " "; + compileCommands.front().insert(0, run_launcher); + } + } + // Expand placeholders in the commands. for(std::vector<std::string>::iterator i = compileCommands.begin(); i != compileCommands.end(); ++i) @@ -1132,8 +1144,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() pi != this->MultipleOutputPairs.end(); ++pi) { *this->InfoFileStream - << " " << cmLocalGenerator::EscapeForCMake(pi->first) - << " " << cmLocalGenerator::EscapeForCMake(pi->second) + << " " << cmOutputConverter::EscapeForCMake(pi->first) + << " " << cmOutputConverter::EscapeForCMake(pi->second) << "\n"; } *this->InfoFileStream << " )\n\n"; @@ -1161,8 +1173,10 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() && linkee->GetType() != cmTarget::INTERFACE_LIBRARY && emitted.insert(linkee).second) { + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(linkee); + cmLocalGenerator* lg = gt->GetLocalGenerator(); cmMakefile* mf = linkee->GetMakefile(); - cmLocalGenerator* lg = mf->GetLocalGenerator(); std::string di = mf->GetCurrentBinaryDirectory(); di += "/"; di += lg->GetTargetDirectory(*linkee); @@ -1595,9 +1609,8 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l) if(emitted.insert(*i).second) { flags += fwSearchFlag; - flags += this->Convert(*i, - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::SHELL, true); + flags += this->LocalGenerator + ->ConvertToOutputFormat(*i, cmLocalGenerator::SHELL); flags += " "; } } @@ -2093,13 +2106,13 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) //---------------------------------------------------------------------------- const char* cmMakefileTargetGenerator::GetFeature(const std::string& feature) { - return this->Target->GetFeature(feature, this->ConfigName); + return this->GeneratorTarget->GetFeature(feature, this->ConfigName); } //---------------------------------------------------------------------------- bool cmMakefileTargetGenerator::GetFeatureAsBool(const std::string& feature) { - return this->Target->GetFeatureAsBool(feature, this->ConfigName); + return this->GeneratorTarget->GetFeatureAsBool(feature, this->ConfigName); } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 58044e8..9182236 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -34,7 +34,7 @@ class cmMakefileTargetGenerator { public: // constructor to set the ivars - cmMakefileTargetGenerator(cmTarget* target); + cmMakefileTargetGenerator(cmGeneratorTarget* target); virtual ~cmMakefileTargetGenerator(); // construct using this factory call @@ -273,10 +273,9 @@ protected: std::string Convert(const std::string& source, cmLocalGenerator::RelativeRoot relative, cmLocalGenerator::OutputFormat output = - cmLocalGenerator::UNCHANGED, - bool optional = false) + cmLocalGenerator::UNCHANGED) { - return this->LocalGenerator->Convert(source, relative, output, optional); + return this->LocalGenerator->Convert(source, relative, output); } }; diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index 25d929c..303ca63 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -21,7 +21,7 @@ //---------------------------------------------------------------------------- cmMakefileUtilityTargetGenerator ::cmMakefileUtilityTargetGenerator(cmGeneratorTarget* target): - cmMakefileTargetGenerator(target->Target) + cmMakefileTargetGenerator(target) { this->CustomCommandDriver = OnUtility; this->OSXBundleGenerator = new cmOSXBundleGenerator(target, diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index bbf03ff..2fe53bf 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -32,7 +32,7 @@ cmNinjaNormalTargetGenerator:: cmNinjaNormalTargetGenerator(cmGeneratorTarget* target) - : cmNinjaTargetGenerator(target->Target) + : cmNinjaTargetGenerator(target) , TargetNameOut() , TargetNameSO() , TargetNameReal() diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 879d6b7..b18f368 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -22,6 +22,7 @@ #include "cmComputeLinkInformation.h" #include "cmSourceFile.h" #include "cmCustomCommandGenerator.h" +#include "cmAlgorithms.h" #include <algorithm> @@ -56,19 +57,18 @@ cmNinjaTargetGenerator::New(cmGeneratorTarget* target) } } -cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmTarget* target) +cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target) : MacOSXContentGenerator(0), OSXBundleGenerator(0), MacContentFolders(), - Target(target), - Makefile(target->GetMakefile()), + Target(target->Target), + Makefile(target->Makefile), LocalGenerator( - static_cast<cmLocalNinjaGenerator*>(Makefile->GetLocalGenerator())), + static_cast<cmLocalNinjaGenerator*>(target->GetLocalGenerator())), Objects() { - this->GeneratorTarget = - this->GetGlobalGenerator()->GetGeneratorTarget(target); + this->GeneratorTarget = target; MacOSXContentGenerator = new MacOSXContentGeneratorType(this); } @@ -107,13 +107,14 @@ std::string cmNinjaTargetGenerator::LanguageCompilerRule( // TODO: Picked up from cmMakefileTargetGenerator. Refactor it. const char* cmNinjaTargetGenerator::GetFeature(const std::string& feature) { - return this->Target->GetFeature(feature, this->GetConfigName()); + return this->GeneratorTarget->GetFeature(feature, this->GetConfigName()); } // TODO: Picked up from cmMakefileTargetGenerator. Refactor it. bool cmNinjaTargetGenerator::GetFeatureAsBool(const std::string& feature) { - return this->Target->GetFeatureAsBool(feature, this->GetConfigName()); + return this->GeneratorTarget->GetFeatureAsBool(feature, + this->GetConfigName()); } // TODO: Picked up from cmMakefileTargetGenerator. Refactor it. @@ -475,6 +476,25 @@ cmNinjaTargetGenerator } } + // Maybe insert a compiler launcher like ccache or distcc + if (!compileCmds.empty() && (lang == "C" || lang == "CXX")) + { + std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER"; + const char *clauncher = this->Target->GetProperty(clauncher_prop); + if (clauncher && *clauncher) + { + std::vector<std::string> launcher_cmd; + cmSystemTools::ExpandListArgument(clauncher, launcher_cmd, true); + for (std::vector<std::string>::iterator i = launcher_cmd.begin(), + e = launcher_cmd.end(); i != e; ++i) + { + *i = this->LocalGenerator->EscapeForShell(*i); + } + std::string const& run_launcher = cmJoin(launcher_cmd, " ") + " "; + compileCmds.front().insert(0, run_launcher); + } + } + if (!compileCmds.empty()) { compileCmds.front().insert(0, cldeps); diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 4e7d8b3..fc361b2 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -33,7 +33,7 @@ public: static cmNinjaTargetGenerator* New(cmGeneratorTarget* target); /// Build a NinjaTargetGenerator. - cmNinjaTargetGenerator(cmTarget* target); + cmNinjaTargetGenerator(cmGeneratorTarget* target); /// Destructor. virtual ~cmNinjaTargetGenerator(); diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index 42d6b46..c3bf011 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -21,7 +21,7 @@ cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator( cmGeneratorTarget *target) - : cmNinjaTargetGenerator(target->Target) {} + : cmNinjaTargetGenerator(target) {} cmNinjaUtilityTargetGenerator::~cmNinjaUtilityTargetGenerator() {} diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index a8eef82..3bc0eb7 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -22,7 +22,7 @@ cmOSXBundleGenerator(cmGeneratorTarget* target, const std::string& configName) : GT(target) , Makefile(target->Target->GetMakefile()) - , LocalGenerator(Makefile->GetLocalGenerator()) + , LocalGenerator(target->GetLocalGenerator()) , ConfigName(configName) , MacContentFolders(0) { diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h index 07c85dd..cb5a51f 100644 --- a/Source/cmOrderDirectories.h +++ b/Source/cmOrderDirectories.h @@ -44,8 +44,6 @@ private: cmTarget const* Target; std::string Purpose; - bool Computed; - std::vector<std::string> OrderedDirectories; std::vector<cmOrderDirectoriesConstraint*> ConstraintEntries; @@ -68,8 +66,9 @@ private: void OrderDirectories(); void VisitDirectory(unsigned int i); void DiagnoseCycle(); - bool CycleDiagnosed; int WalkId; + bool CycleDiagnosed; + bool Computed; // Adjacency-list representation of runtime path ordering graph. // This maps from directory to those that must come *before* it. diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx new file mode 100644 index 0000000..b0a30a1 --- /dev/null +++ b/Source/cmOutputConverter.cxx @@ -0,0 +1,447 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmOutputConverter.h" + +#include "cmAlgorithms.h" +#include "cmake.h" + +#include <cmsys/System.h> + +#include <assert.h> + +cmOutputConverter::cmOutputConverter(cmState::Snapshot snapshot) + : StateSnapshot(snapshot), LinkScriptShell(false) +{ +} + +//---------------------------------------------------------------------------- +std::string +cmOutputConverter::ConvertToOutputForExistingCommon(const std::string& remote, + std::string const& result, + OutputFormat format) const +{ + // If this is a windows shell, the result has a space, and the path + // already exists, we can use a short-path to reference it without a + // space. + if(this->GetState()->UseWindowsShell() && result.find(' ') != result.npos && + cmSystemTools::FileExists(remote.c_str())) + { + std::string tmp; + if(cmSystemTools::GetShortPath(remote, tmp)) + { + return this->ConvertToOutputFormat(tmp, format); + } + } + + // Otherwise, leave it unchanged. + return result; +} + +//---------------------------------------------------------------------------- +std::string +cmOutputConverter::ConvertToOutputForExisting(const std::string& remote, + RelativeRoot local, + OutputFormat format) const +{ + static_cast<void>(local); + + // Perform standard conversion. + std::string result = this->ConvertToOutputFormat(remote, format); + + // Consider short-path. + return this->ConvertToOutputForExistingCommon(remote, result, format); +} + +//---------------------------------------------------------------------------- +std::string +cmOutputConverter::ConvertToOutputForExisting(RelativeRoot remote, + const std::string& local, + OutputFormat format) const +{ + // Perform standard conversion. + std::string result = this->Convert(remote, local, format, true); + + // Consider short-path. + const char* remotePath = this->GetRelativeRootPath(remote); + return this->ConvertToOutputForExistingCommon(remotePath, result, format); +} + +//---------------------------------------------------------------------------- +const char* cmOutputConverter::GetRelativeRootPath(RelativeRoot relroot) const +{ + switch (relroot) + { + case HOME: return this->GetState()->GetSourceDirectory(); + case START: return this->StateSnapshot.GetCurrentSourceDirectory(); + case HOME_OUTPUT: return this->GetState()->GetBinaryDirectory(); + case START_OUTPUT: return this->StateSnapshot.GetCurrentBinaryDirectory(); + default: break; + } + return 0; +} + +std::string cmOutputConverter::Convert(const std::string& source, + RelativeRoot relative, + OutputFormat output) const +{ + // Convert the path to a relative path. + std::string result = source; + + switch (relative) + { + case HOME: + result = this->ConvertToRelativePath( + this->GetState()->GetSourceDirectoryComponents(), result); + break; + case START: + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result); + break; + case HOME_OUTPUT: + result = this->ConvertToRelativePath( + this->GetState()->GetBinaryDirectoryComponents(), result); + break; + case START_OUTPUT: + result = this->ConvertToRelativePath( + this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result); + break; + case FULL: + result = cmSystemTools::CollapseFullPath(result); + break; + case NONE: + break; + } + return this->ConvertToOutputFormat(result, output); +} + +//---------------------------------------------------------------------------- +std::string cmOutputConverter::ConvertToOutputFormat(const std::string& source, + OutputFormat output) const +{ + std::string result = source; + // Convert it to an output path. + if (output == MAKERULE) + { + result = cmSystemTools::ConvertToOutputPath(result.c_str()); + } + else if(output == SHELL || output == WATCOMQUOTE) + { + // For the MSYS shell convert drive letters to posix paths, so + // that c:/some/path becomes /c/some/path. This is needed to + // avoid problems with the shell path translation. + if(this->GetState()->UseMSYSShell() && !this->LinkScriptShell) + { + if(result.size() > 2 && result[1] == ':') + { + result[1] = result[0]; + result[0] = '/'; + } + } + if(this->GetState()->UseWindowsShell()) + { + std::replace(result.begin(), result.end(), '/', '\\'); + } + result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE); + } + else if(output == RESPONSE) + { + result = this->EscapeForShell(result, false, false, false); + } + return result; +} + +//---------------------------------------------------------------------------- +std::string cmOutputConverter::Convert(RelativeRoot remote, + const std::string& local, + OutputFormat output, + bool optional) const +{ + const char* remotePath = this->GetRelativeRootPath(remote); + + // The relative root must have a path (i.e. not FULL or NONE) + assert(remotePath != 0); + + if(!local.empty() && !optional) + { + std::vector<std::string> components; + cmSystemTools::SplitPath(local, components); + std::string result = this->ConvertToRelativePath(components, remotePath); + return this->ConvertToOutputFormat(result, output); + } + + return this->ConvertToOutputFormat(remotePath, output); +} + +//---------------------------------------------------------------------------- +static bool cmOutputConverterNotAbove(const char* a, const char* b) +{ + return (cmSystemTools::ComparePath(a, b) || + cmSystemTools::IsSubDirectory(a, b)); +} + +//---------------------------------------------------------------------------- +std::string +cmOutputConverter::ConvertToRelativePath(const std::vector<std::string>& local, + const std::string& in_remote, + bool force) const +{ + // The path should never be quoted. + assert(in_remote[0] != '\"'); + + // The local path should never have a trailing slash. + assert(!local.empty() && !(local[local.size()-1] == "")); + + // If the path is already relative then just return the path. + if(!cmSystemTools::FileIsFullPath(in_remote.c_str())) + { + return in_remote; + } + + if(!force) + { + // Skip conversion if the path and local are not both in the source + // or both in the binary tree. + std::string local_path = cmSystemTools::JoinPath(local); + if(!((cmOutputConverterNotAbove(local_path.c_str(), + this->StateSnapshot.GetRelativePathTopBinary()) && + cmOutputConverterNotAbove(in_remote.c_str(), + this->StateSnapshot.GetRelativePathTopBinary())) || + (cmOutputConverterNotAbove(local_path.c_str(), + this->StateSnapshot.GetRelativePathTopSource()) && + cmOutputConverterNotAbove(in_remote.c_str(), + this->StateSnapshot.GetRelativePathTopSource())))) + { + return in_remote; + } + } + + // Identify the longest shared path component between the remote + // path and the local path. + std::vector<std::string> remote; + cmSystemTools::SplitPath(in_remote, remote); + unsigned int common=0; + while(common < remote.size() && + common < local.size() && + cmSystemTools::ComparePath(remote[common], + local[common])) + { + ++common; + } + + // If no part of the path is in common then return the full path. + if(common == 0) + { + return in_remote; + } + + // If the entire path is in common then just return a ".". + if(common == remote.size() && + common == local.size()) + { + return "."; + } + + // If the entire path is in common except for a trailing slash then + // just return a "./". + if(common+1 == remote.size() && + remote[common].empty() && + common == local.size()) + { + return "./"; + } + + // Construct the relative path. + std::string relative; + + // First add enough ../ to get up to the level of the shared portion + // of the path. Leave off the trailing slash. Note that the last + // component of local will never be empty because local should never + // have a trailing slash. + for(unsigned int i=common; i < local.size(); ++i) + { + relative += ".."; + if(i < local.size()-1) + { + relative += "/"; + } + } + + // Now add the portion of the destination path that is not included + // in the shared portion of the path. Add a slash the first time + // only if there was already something in the path. If there was a + // trailing slash in the input then the last iteration of the loop + // will add a slash followed by an empty string which will preserve + // the trailing slash in the output. + + if(!relative.empty() && !remote.empty()) + { + relative += "/"; + } + relative += cmJoin(cmRange(remote).advance(common), "/"); + + // Finally return the path. + return relative; +} + +//---------------------------------------------------------------------------- +static bool cmOutputConverterIsShellOperator(const std::string& str) +{ + static std::set<std::string> shellOperators; + if(shellOperators.empty()) + { + shellOperators.insert("<"); + shellOperators.insert(">"); + shellOperators.insert("<<"); + shellOperators.insert(">>"); + shellOperators.insert("|"); + shellOperators.insert("||"); + shellOperators.insert("&&"); + shellOperators.insert("&>"); + shellOperators.insert("1>"); + shellOperators.insert("2>"); + shellOperators.insert("2>&1"); + shellOperators.insert("1>&2"); + } + return shellOperators.count(str) > 0; +} + +//---------------------------------------------------------------------------- +std::string cmOutputConverter::EscapeForShell(const std::string& str, + bool makeVars, + bool forEcho, + bool useWatcomQuote) const +{ + // Do not escape shell operators. + if(cmOutputConverterIsShellOperator(str)) + { + return str; + } + + // Compute the flags for the target shell environment. + int flags = 0; + if(this->GetState()->UseWindowsVSIDE()) + { + flags |= cmsysSystem_Shell_Flag_VSIDE; + } + else if(!this->LinkScriptShell) + { + flags |= cmsysSystem_Shell_Flag_Make; + } + if(makeVars) + { + flags |= cmsysSystem_Shell_Flag_AllowMakeVariables; + } + if(forEcho) + { + flags |= cmsysSystem_Shell_Flag_EchoWindows; + } + if(useWatcomQuote) + { + flags |= cmsysSystem_Shell_Flag_WatcomQuote; + } + if(this->GetState()->UseWatcomWMake()) + { + flags |= cmsysSystem_Shell_Flag_WatcomWMake; + } + if(this->GetState()->UseMinGWMake()) + { + flags |= cmsysSystem_Shell_Flag_MinGWMake; + } + if(this->GetState()->UseNMake()) + { + flags |= cmsysSystem_Shell_Flag_NMake; + } + + // Compute the buffer size needed. + int size = (this->GetState()->UseWindowsShell() ? + cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) : + cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags)); + + // Compute the shell argument itself. + std::vector<char> arg(size); + if(this->GetState()->UseWindowsShell()) + { + cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags); + } + else + { + cmsysSystem_Shell_GetArgumentForUnix(str.c_str(), &arg[0], flags); + } + return std::string(&arg[0]); +} + +//---------------------------------------------------------------------------- +std::string cmOutputConverter::EscapeForCMake(const std::string& str) +{ + // Always double-quote the argument to take care of most escapes. + std::string result = "\""; + for(const char* c = str.c_str(); *c; ++c) + { + if(*c == '"') + { + // Escape the double quote to avoid ending the argument. + result += "\\\""; + } + else if(*c == '$') + { + // Escape the dollar to avoid expanding variables. + result += "\\$"; + } + else if(*c == '\\') + { + // Escape the backslash to avoid other escapes. + result += "\\\\"; + } + else + { + // Other characters will be parsed correctly. + result += *c; + } + } + result += "\""; + return result; +} + +//---------------------------------------------------------------------------- +cmOutputConverter::FortranFormat +cmOutputConverter::GetFortranFormat(const char* value) +{ + FortranFormat format = FortranFormatNone; + if(value && *value) + { + std::vector<std::string> fmt; + cmSystemTools::ExpandListArgument(value, fmt); + for(std::vector<std::string>::iterator fi = fmt.begin(); + fi != fmt.end(); ++fi) + { + if(*fi == "FIXED") + { + format = FortranFormatFixed; + } + if(*fi == "FREE") + { + format = FortranFormatFree; + } + } + } + return format; +} + +void cmOutputConverter::SetLinkScriptShell(bool linkScriptShell) +{ + this->LinkScriptShell = linkScriptShell; +} + +cmState* cmOutputConverter::GetState() const +{ + return this->StateSnapshot.GetState(); +} diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h new file mode 100644 index 0000000..482a64b --- /dev/null +++ b/Source/cmOutputConverter.h @@ -0,0 +1,106 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmOutputConverter_h +#define cmOutputConverter_h + +#include "cmStandardIncludes.h" + +#include "cmGlobalGenerator.h" +#include "cmState.h" + +class cmOutputConverter +{ +public: + cmOutputConverter(cmState::Snapshot snapshot); + + /** + * Convert something to something else. This is a centralized conversion + * routine used by the generators to handle relative paths and the like. + * The flags determine what is actually done. + * + * relative: treat the argument as a directory and convert it to make it + * relative or full or unchanged. If relative (HOME, START etc) then that + * specifies what it should be relative to. + * + * output: make the result suitable for output to a... + * + * optional: should any relative path operation be controlled by the rel + * path setting + */ + enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT }; + enum OutputFormat { UNCHANGED, MAKERULE, SHELL, WATCOMQUOTE, RESPONSE }; + std::string ConvertToOutputFormat(const std::string& source, + OutputFormat output) const; + std::string Convert(const std::string& remote, RelativeRoot local, + OutputFormat output = UNCHANGED) const; + std::string Convert(RelativeRoot remote, const std::string& local, + OutputFormat output = UNCHANGED, + bool optional = false) const; + + /** + * Get path for the specified relative root. + */ + const char* GetRelativeRootPath(RelativeRoot relroot) const; + + ///! for existing files convert to output path and short path if spaces + std::string ConvertToOutputForExisting(const std::string& remote, + RelativeRoot local = START_OUTPUT, + OutputFormat format = SHELL) const; + + /** For existing path identified by RelativeRoot convert to output + path and short path if spaces. */ + std::string ConvertToOutputForExisting(RelativeRoot remote, + const std::string& local = "", + OutputFormat format = SHELL) const; + + void SetLinkScriptShell(bool linkScriptShell); + + std::string EscapeForShell(const std::string& str, + bool makeVars = false, + bool forEcho = false, + bool useWatcomQuote = false) const; + + static std::string EscapeForCMake(const std::string& str); + + enum FortranFormat + { + FortranFormatNone, + FortranFormatFixed, + FortranFormatFree + }; + static FortranFormat GetFortranFormat(const char* value); + + /** + * Convert the given remote path to a relative path with respect to + * the given local path. The local path must be given in component + * form (see SystemTools::SplitPath) without a trailing slash. The + * remote path must use forward slashes and not already be escaped + * or quoted. + */ + std::string ConvertToRelativePath(const std::vector<std::string>& local, + const std::string& in_remote, + bool force = false) const; + +private: + cmState* GetState() const; + + std::string ConvertToOutputForExistingCommon(const std::string& remote, + std::string const& result, + OutputFormat format) const; + +private: + cmState::Snapshot StateSnapshot; + + bool LinkScriptShell; +}; + +#endif diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index f8d61db..5026893 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -343,29 +343,24 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) return e.str(); } -cmPolicies::PolicyMap::PolicyMap() -{ - this->UNDEFINED.set(); -} - cmPolicies::PolicyStatus cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const { PolicyStatus status = cmPolicies::WARN; - if (this->OLD[id]) + if (this->Status[(POLICY_STATUS_COUNT * id) + OLD]) { status = cmPolicies::OLD; } - else if (this->NEW[id]) + else if (this->Status[(POLICY_STATUS_COUNT * id) + NEW]) { status = cmPolicies::NEW; } - else if (this->REQUIRED_ALWAYS[id]) + else if (this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS]) { status = cmPolicies::REQUIRED_ALWAYS; } - else if (this->REQUIRED_IF_USED[id]) + else if (this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED]) { status = cmPolicies::REQUIRED_IF_USED; } @@ -375,19 +370,25 @@ cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status) { - this->UNDEFINED.reset(id); - this->OLD[id] = (status == cmPolicies::OLD); - this->NEW[id] = (status == cmPolicies::NEW); - this->REQUIRED_ALWAYS[id] = (status == cmPolicies::REQUIRED_ALWAYS); - this->REQUIRED_IF_USED[id] = (status == cmPolicies::REQUIRED_IF_USED); + this->Status[(POLICY_STATUS_COUNT * id) + OLD] = (status == OLD); + this->Status[(POLICY_STATUS_COUNT * id) + WARN] = (status == WARN); + this->Status[(POLICY_STATUS_COUNT * id) + NEW] = (status == NEW); + this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS] = + (status == REQUIRED_ALWAYS); + this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED] = + (status == REQUIRED_IF_USED); } bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const { - return !this->UNDEFINED[id]; + return this->Status[(POLICY_STATUS_COUNT * id) + OLD] + || this->Status[(POLICY_STATUS_COUNT * id) + WARN] + || this->Status[(POLICY_STATUS_COUNT * id) + NEW] + || this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS] + || this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED]; } bool cmPolicies::PolicyMap::IsEmpty() const { - return !this->UNDEFINED.none(); + return this->Status.none(); } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 00d857a..8a3c27d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -244,6 +244,7 @@ public: REQUIRED_IF_USED, REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW. }; +#define POLICY_STATUS_COUNT 5 /// Policy identifiers enum PolicyID @@ -281,18 +282,13 @@ public: /** Represent a set of policy values. */ struct PolicyMap { - PolicyMap(); PolicyStatus Get(PolicyID id) const; void Set(PolicyID id, PolicyStatus status); bool IsDefined(PolicyID id) const; bool IsEmpty() const; private: - std::bitset<cmPolicies::CMPCOUNT> UNDEFINED; - std::bitset<cmPolicies::CMPCOUNT> OLD; - std::bitset<cmPolicies::CMPCOUNT> NEW; - std::bitset<cmPolicies::CMPCOUNT> REQUIRED_IF_USED; - std::bitset<cmPolicies::CMPCOUNT> REQUIRED_ALWAYS; + std::bitset<cmPolicies::CMPCOUNT * POLICY_STATUS_COUNT> Status; }; }; diff --git a/Source/cmProcessTools.cxx b/Source/cmProcessTools.cxx index d2f7bf3..15d9ed0 100644 --- a/Source/cmProcessTools.cxx +++ b/Source/cmProcessTools.cxx @@ -44,7 +44,7 @@ void cmProcessTools::RunProcess(struct cmsysProcess_s* cp, //---------------------------------------------------------------------------- cmProcessTools::LineParser::LineParser(char sep, bool ignoreCR): - Separator(sep), IgnoreCR(ignoreCR), Log(0), Prefix(0), LineEnd('\0') + Log(0), Prefix(0), Separator(sep), LineEnd('\0'), IgnoreCR(ignoreCR) { } diff --git a/Source/cmProcessTools.h b/Source/cmProcessTools.h index 439726d..23833ca 100644 --- a/Source/cmProcessTools.h +++ b/Source/cmProcessTools.h @@ -51,12 +51,12 @@ public: /** Configure logging of lines as they are extracted. */ void SetLog(std::ostream* log, const char* prefix); protected: - char Separator; - bool IgnoreCR; std::ostream* Log; const char* Prefix; - char LineEnd; std::string Line; + char Separator; + char LineEnd; + bool IgnoreCR; virtual bool ProcessChunk(const char* data, int length); /** Implement in a subclass to process one line of input. It diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 176cb0d..46d7e01 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -53,7 +53,7 @@ bool cmProjectCommand // CMAKE_PROJECT_NAME will match PROJECT_NAME, and cmake --build // will work. if(!this->Makefile->GetDefinition("CMAKE_PROJECT_NAME") - || (this->Makefile->GetLocalGenerator()->IsRootMakefile())) + || (this->Makefile->IsRootMakefile())) { this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", args[0].c_str()); this->Makefile->AddCacheDefinition @@ -233,7 +233,6 @@ bool cmProjectCommand const char* include = this->Makefile->GetDefinition(extraInclude); if(include) { - std::string fullFilePath; bool readit = this->Makefile->ReadDependentFile(include); if(!readit && !cmSystemTools::GetFatalErrorOccured()) diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx index 40976db..ef57068 100644 --- a/Source/cmProperty.cxx +++ b/Source/cmProperty.cxx @@ -12,17 +12,14 @@ #include "cmProperty.h" #include "cmSystemTools.h" -void cmProperty::Set(const std::string& name, const char *value) +void cmProperty::Set(const char *value) { - this->Name = name; this->Value = value; this->ValueHasBeenSet = true; } -void cmProperty::Append(const std::string& name, const char *value, - bool asString) +void cmProperty::Append(const char *value, bool asString) { - this->Name = name; if(!this->Value.empty() && *value && !asString) { this->Value += ";"; diff --git a/Source/cmProperty.h b/Source/cmProperty.h index 659c4c3..e026372 100644 --- a/Source/cmProperty.h +++ b/Source/cmProperty.h @@ -21,11 +21,10 @@ public: TEST, VARIABLE, CACHED_VARIABLE, INSTALL }; // set this property - void Set(const std::string& name, const char *value); + void Set(const char *value); // append to this property - void Append(const std::string& name, const char *value, - bool asString = false); + void Append(const char *value, bool asString = false); // get the value const char *GetValue() const; @@ -34,7 +33,6 @@ public: cmProperty() { this->ValueHasBeenSet = false; } protected: - std::string Name; std::string Value; bool ValueHasBeenSet; }; diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx index 3875318..776fad1 100644 --- a/Source/cmPropertyDefinitionMap.cxx +++ b/Source/cmPropertyDefinitionMap.cxx @@ -29,9 +29,9 @@ void cmPropertyDefinitionMap } } -bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) +bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) const { - cmPropertyDefinitionMap::iterator it = this->find(name); + cmPropertyDefinitionMap::const_iterator it = this->find(name); if (it == this->end()) { return false; @@ -40,9 +40,9 @@ bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) return true; } -bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name) +bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name) const { - cmPropertyDefinitionMap::iterator it = this->find(name); + cmPropertyDefinitionMap::const_iterator it = this->find(name); if (it == this->end()) { return false; diff --git a/Source/cmPropertyDefinitionMap.h b/Source/cmPropertyDefinitionMap.h index 00c7328..f95c721 100644 --- a/Source/cmPropertyDefinitionMap.h +++ b/Source/cmPropertyDefinitionMap.h @@ -27,10 +27,10 @@ public: bool chain); // has a named property been defined - bool IsPropertyDefined(const std::string& name); + bool IsPropertyDefined(const std::string& name) const; // is a named property set to chain - bool IsPropertyChained(const std::string& name); + bool IsPropertyChained(const std::string& name) const; }; #endif diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index 070f6f1..ef09dbc 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -14,6 +14,8 @@ #include "cmake.h" #include "cmState.h" +#include <assert.h> + cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name) { cmPropertyMap::iterator it = this->find(name); @@ -29,54 +31,39 @@ cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name) return prop; } -void cmPropertyMap::SetProperty(const std::string& name, const char *value, - cmProperty::ScopeType scope) +void cmPropertyMap::SetProperty(const std::string& name, const char *value) { if(!value) { this->erase(name); return; } - (void)scope; cmProperty *prop = this->GetOrCreateProperty(name); - prop->Set(name,value); + prop->Set(value); } void cmPropertyMap::AppendProperty(const std::string& name, const char* value, - cmProperty::ScopeType scope, bool asString) + bool asString) { // Skip if nothing to append. if(!value || !*value) { return; } - (void)scope; cmProperty *prop = this->GetOrCreateProperty(name); - prop->Append(name,value,asString); + prop->Append(value,asString); } const char *cmPropertyMap -::GetPropertyValue(const std::string& name, - cmProperty::ScopeType scope, - bool &chain) const +::GetPropertyValue(const std::string& name) const { - chain = false; - if (name.empty()) - { - return 0; - } + assert(!name.empty()); cmPropertyMap::const_iterator it = this->find(name); if (it == this->end()) { - // should we chain up? - if (this->CMakeInstance) - { - chain = this->CMakeInstance->GetState()-> - IsPropertyChained(name,scope); - } return 0; } return it->second.GetValue(); diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index 02d4235..a9062db 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -14,29 +14,17 @@ #include "cmProperty.h" -class cmake; - class cmPropertyMap : public std::map<std::string,cmProperty> { public: cmProperty *GetOrCreateProperty(const std::string& name); - void SetProperty(const std::string& name, const char *value, - cmProperty::ScopeType scope); + void SetProperty(const std::string& name, const char *value); void AppendProperty(const std::string& name, const char* value, - cmProperty::ScopeType scope, bool asString=false); - - const char *GetPropertyValue(const std::string& name, - cmProperty::ScopeType scope, - bool &chain) const; - - void SetCMakeInstance(cmake *cm) { this->CMakeInstance = cm; } - - cmPropertyMap() { this->CMakeInstance = 0;} + bool asString=false); -private: - cmake *CMakeInstance; + const char *GetPropertyValue(const std::string& name) const; }; #endif diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index cbb06cd..32b9566 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -368,8 +368,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) #if defined(_WIN32) && !defined(__CYGWIN__) bool usePRE_BUILD = false; - cmLocalGenerator* localGen = makefile->GetLocalGenerator(); - cmGlobalGenerator* gg = localGen->GetGlobalGenerator(); + cmGlobalGenerator* gg = makefile->GetGlobalGenerator(); if(gg->GetName().find("Visual Studio") != std::string::npos) { cmGlobalVisualStudioGenerator* vsgg = @@ -440,6 +439,9 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) this->ListQt4RccInputs(sf, depends); } #if defined(_WIN32) && !defined(__CYGWIN__) + // Cannot use PRE_BUILD because the resource files themselves + // may not be sources within the target so VS may not know the + // target needs to re-build at all. usePRE_BUILD = false; #endif } @@ -466,31 +468,11 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) else #endif { - cmTarget* autogenTarget = 0; - if (!rcc_output.empty() && !isNinja) - { - std::vector<std::string> no_byproducts; - makefile->AddCustomCommandToOutput(rcc_output, no_byproducts, - depends, "", - commandLines, 0, - workingDirectory.c_str(), - false, false); - - cmCustomCommandLines no_commands; - autogenTarget = makefile->AddUtilityCommand( - autogenTargetName, true, - workingDirectory.c_str(), rcc_output, - no_commands, false, autogenComment.c_str()); - - } - else - { - autogenTarget = makefile->AddUtilityCommand( + cmTarget* autogenTarget = makefile->AddUtilityCommand( autogenTargetName, true, workingDirectory.c_str(), /*byproducts=*/rcc_output, depends, commandLines, false, autogenComment.c_str()); - } // Set target folder const char* autogenFolder = makefile->GetState() @@ -522,10 +504,10 @@ static void GetCompileDefinitionsAndDirectories(cmTarget const* target, std::string &defs) { cmMakefile* makefile = target->GetMakefile(); - cmLocalGenerator* localGen = makefile->GetLocalGenerator(); + cmGlobalGenerator* globalGen = makefile->GetGlobalGenerator(); std::vector<std::string> includeDirs; - cmGeneratorTarget *gtgt = localGen->GetGlobalGenerator() - ->GetGeneratorTarget(target); + cmGeneratorTarget *gtgt = globalGen->GetGeneratorTarget(target); + cmLocalGenerator *localGen = gtgt->GetLocalGenerator(); // Get the include dirs for this target, without stripping the implicit // include dirs off, see http://public.kitware.com/Bug/view.php?id=13667 localGen->GetIncludeDirectories(includeDirs, gtgt, "CXX", config, false); @@ -550,9 +532,9 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) std::string autogenTargetName = getAutogenTargetName(target); makefile->AddDefinition("_moc_target_name", - cmLocalGenerator::EscapeForCMake(autogenTargetName).c_str()); + cmOutputConverter::EscapeForCMake(autogenTargetName).c_str()); makefile->AddDefinition("_origin_target_name", - cmLocalGenerator::EscapeForCMake(target->GetName()).c_str()); + cmOutputConverter::EscapeForCMake(target->GetName()).c_str()); std::string targetDir = getAutogenTargetDir(target); @@ -582,7 +564,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) this->SetupSourceFiles(target); } makefile->AddDefinition("_cpp_files", - cmLocalGenerator::EscapeForCMake(this->Sources).c_str()); + cmOutputConverter::EscapeForCMake(this->Sources).c_str()); if (target->GetPropertyAsBool("AUTOMOC")) { this->SetupAutoMocTarget(target, autogenTargetName, @@ -609,7 +591,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) // Ensure we have write permission in case .in was read-only. mode_t perm = 0; -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) mode_t mode_write = S_IWRITE; #else mode_t mode_write = S_IWUSR; @@ -764,11 +746,11 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS"); std::string _moc_options = (tmp!=0 ? tmp : ""); makefile->AddDefinition("_moc_options", - cmLocalGenerator::EscapeForCMake(_moc_options).c_str()); + cmOutputConverter::EscapeForCMake(_moc_options).c_str()); makefile->AddDefinition("_skip_moc", - cmLocalGenerator::EscapeForCMake(this->SkipMoc).c_str()); + cmOutputConverter::EscapeForCMake(this->SkipMoc).c_str()); makefile->AddDefinition("_moc_headers", - cmLocalGenerator::EscapeForCMake(this->Headers).c_str()); + cmOutputConverter::EscapeForCMake(this->Headers).c_str()); bool relaxedMode = makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE"); makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE"); @@ -780,9 +762,9 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, _moc_incs, _moc_compile_defs); makefile->AddDefinition("_moc_incs", - cmLocalGenerator::EscapeForCMake(_moc_incs).c_str()); + cmOutputConverter::EscapeForCMake(_moc_incs).c_str()); makefile->AddDefinition("_moc_compile_defs", - cmLocalGenerator::EscapeForCMake(_moc_compile_defs).c_str()); + cmOutputConverter::EscapeForCMake(_moc_compile_defs).c_str()); for (std::vector<std::string>::const_iterator li = configs.begin(); li != configs.end(); ++li) @@ -795,7 +777,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, if (config_moc_incs != _moc_incs) { configIncludes[*li] = - cmLocalGenerator::EscapeForCMake(config_moc_incs); + cmOutputConverter::EscapeForCMake(config_moc_incs); if(_moc_incs.empty()) { _moc_incs = config_moc_incs; @@ -804,7 +786,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, if (config_moc_compile_defs != _moc_compile_defs) { configDefines[*li] = - cmLocalGenerator::EscapeForCMake(config_moc_compile_defs); + cmOutputConverter::EscapeForCMake(config_moc_compile_defs); if(_moc_compile_defs.empty()) { _moc_compile_defs = config_moc_compile_defs; @@ -906,7 +888,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, skipped.insert(skipVec.begin(), skipVec.end()); makefile->AddDefinition("_skip_uic", - cmLocalGenerator::EscapeForCMake(this->SkipUic).c_str()); + cmOutputConverter::EscapeForCMake(this->SkipUic).c_str()); std::vector<cmSourceFile*> uiFilesWithOptions = makefile->GetQtUiFilesWithOptions(); @@ -920,7 +902,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, if (!_uic_opts.empty()) { - _uic_opts = cmLocalGenerator::EscapeForCMake(_uic_opts); + _uic_opts = cmOutputConverter::EscapeForCMake(_uic_opts); makefile->AddDefinition("_uic_target_options", _uic_opts.c_str()); } for (std::vector<std::string>::const_iterator li = configs.begin(); @@ -931,7 +913,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, if (config_uic_opts != _uic_opts) { configUicOptions[*li] = - cmLocalGenerator::EscapeForCMake(config_uic_opts); + cmOutputConverter::EscapeForCMake(config_uic_opts); if(_uic_opts.empty()) { _uic_opts = config_uic_opts; @@ -966,9 +948,9 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, } makefile->AddDefinition("_qt_uic_options_files", - cmLocalGenerator::EscapeForCMake(uiFileFiles).c_str()); + cmOutputConverter::EscapeForCMake(uiFileFiles).c_str()); makefile->AddDefinition("_qt_uic_options_options", - cmLocalGenerator::EscapeForCMake(uiFileOptions).c_str()); + cmOutputConverter::EscapeForCMake(uiFileOptions).c_str()); std::string targetName = target->GetName(); if (strcmp(qtVersion, "5") == 0) @@ -1141,15 +1123,15 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) } } makefile->AddDefinition("_qt_rcc_inputs_" + target->GetName(), - cmLocalGenerator::EscapeForCMake(qrcInputs).c_str()); + cmOutputConverter::EscapeForCMake(qrcInputs).c_str()); makefile->AddDefinition("_rcc_files", - cmLocalGenerator::EscapeForCMake(_rcc_files).c_str()); + cmOutputConverter::EscapeForCMake(_rcc_files).c_str()); makefile->AddDefinition("_qt_rcc_options_files", - cmLocalGenerator::EscapeForCMake(rccFileFiles).c_str()); + cmOutputConverter::EscapeForCMake(rccFileFiles).c_str()); makefile->AddDefinition("_qt_rcc_options_options", - cmLocalGenerator::EscapeForCMake(rccFileOptions).c_str()); + cmOutputConverter::EscapeForCMake(rccFileOptions).c_str()); makefile->AddDefinition("_qt_rcc_executable", this->GetRccExecutable(target).c_str()); @@ -1215,7 +1197,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, cmLocalGenerator* lg = gg.MakeLocalGenerator(); lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory); lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory); - gg.SetCurrentLocalGenerator(lg); + gg.SetCurrentMakefile(lg->GetMakefile()); this->ReadAutogenInfoFile(lg->GetMakefile(), targetDirectory, config); this->ReadOldMocDefinitionsFile(lg->GetMakefile(), targetDirectory); @@ -1434,7 +1416,7 @@ cmQtAutoGenerators::WriteOldMocDefinitionsFile( outfile.open(filename.c_str(), std::ios::trunc); outfile << "set(AM_OLD_COMPILE_SETTINGS " - << cmLocalGenerator::EscapeForCMake( + << cmOutputConverter::EscapeForCMake( this->CurrentCompileSettingsStr) << ")\n"; outfile.close(); diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index f74e3c5..4c0fcbc 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -105,7 +105,6 @@ private: std::string SkipMoc; std::string SkipUic; std::string Headers; - bool IncludeProjectDirsBefore; std::string Srcdir; std::string Builddir; std::string MocExecutable; @@ -131,6 +130,7 @@ private: std::map<std::string, std::string> RccOptions; std::map<std::string, std::vector<std::string> > RccInputs; + bool IncludeProjectDirsBefore; bool Verbose; bool ColorOutput; bool RunMocFailed; @@ -138,7 +138,6 @@ private: bool RunRccFailed; bool GenerateAll; bool RelaxedMode; - }; #endif diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index e9cfacc..53dc5a8 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -85,8 +85,10 @@ bool cmSetTestsPropertiesCommand unsigned int k; for (k = 0; k < propertyPairs.size(); k = k + 2) { - test->SetProperty(propertyPairs[k], - propertyPairs[k+1].c_str()); + if (!propertyPairs[k].empty()) + { + test->SetProperty(propertyPairs[k], propertyPairs[k+1].c_str()); + } } } else diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 724ab39..86f0a7a 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -22,7 +22,6 @@ cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name): Location(mf, name) { this->CustomCommand = 0; - this->Properties.SetCMakeInstance(mf->GetCMakeInstance()); this->FindFullPathFailed = false; this->IsUiFile = (".ui" == cmSystemTools::GetFilenameLastExtension(this->Location.GetName())); @@ -299,7 +298,7 @@ bool cmSourceFile::Matches(cmSourceFileLocation const& loc) //---------------------------------------------------------------------------- void cmSourceFile::SetProperty(const std::string& prop, const char* value) { - this->Properties.SetProperty(prop, value, cmProperty::SOURCE_FILE); + this->Properties.SetProperty(prop, value); if (this->IsUiFile) { @@ -315,8 +314,7 @@ void cmSourceFile::SetProperty(const std::string& prop, const char* value) void cmSourceFile::AppendProperty(const std::string& prop, const char* value, bool asString) { - this->Properties.AppendProperty(prop, value, cmProperty::SOURCE_FILE, - asString); + this->Properties.AppendProperty(prop, value, asString); } //---------------------------------------------------------------------------- @@ -362,13 +360,16 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const } } - bool chain = false; - const char *retVal = - this->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE, chain); - if (chain) + const char *retVal = this->Properties.GetPropertyValue(prop); + if (!retVal) { cmMakefile const* mf = this->Location.GetMakefile(); - return mf->GetProperty(prop,cmProperty::SOURCE_FILE); + const bool chain = mf->GetState()-> + IsPropertyChained(prop, cmProperty::SOURCE_FILE); + if (chain) + { + return mf->GetProperty(prop, chain); + } } return retVal; diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index f898260..1433b54 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -107,8 +107,9 @@ private: std::string Extension; std::string Language; std::string FullPath; - bool FindFullPathFailed; std::string ObjectLibrary; + std::vector<std::string> Depends; + bool FindFullPathFailed; bool IsUiFile; bool FindFullPath(std::string* error); @@ -116,7 +117,6 @@ private: void CheckExtension(); void CheckLanguage(std::string const& ext); - std::vector<std::string> Depends; static const std::string propLANGUAGE; }; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 58885d3..58500cc 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -18,6 +18,30 @@ #include <assert.h> +struct cmState::SnapshotDataType +{ + cmState::PositionType DirectoryParent; + cmState::SnapshotType SnapshotType; + cmLinkedTree<cmState::BuildsystemDirectoryStateType>::iterator + BuildSystemDirectory; +}; + +struct cmState::BuildsystemDirectoryStateType +{ + std::string Location; + std::string OutputLocation; + + std::vector<std::string> CurrentSourceDirectoryComponents; + std::vector<std::string> CurrentBinaryDirectoryComponents; + // The top-most directories for relative path conversion. Both the + // source and destination location of a relative path conversion + // must be underneath one of these directories (both under source or + // both under binary) in order for the relative path to be evaluated + // safely by the build tools. + std::string RelativePathTopSource; + std::string RelativePathTopBinary; +}; + cmState::cmState(cmake* cm) : CMakeInstance(cm), IsInTryCompile(false), @@ -195,34 +219,13 @@ void cmState::RemoveCacheEntryProperty(std::string const& key, ->GetCacheIterator(key.c_str()).SetProperty(propertyName, (void*)0); } -void cmState::Reset() +cmState::Snapshot cmState::Reset() { this->GlobalProperties.clear(); this->PropertyDefinitions.clear(); - assert(this->Locations.size() > 0); - assert(this->OutputLocations.size() > 0); - assert(this->ParentPositions.size() > 0); - assert(this->CurrentSourceDirectoryComponents.size() > 0); - assert(this->CurrentBinaryDirectoryComponents.size() > 0); - assert(this->RelativePathTopSource.size() > 0); - assert(this->RelativePathTopBinary.size() > 0); - - this->Locations.erase(this->Locations.begin() + 1, this->Locations.end()); - this->OutputLocations.erase(this->OutputLocations.begin() + 1, - this->OutputLocations.end()); - this->ParentPositions.erase(this->ParentPositions.begin() + 1, - this->ParentPositions.end()); - this->CurrentSourceDirectoryComponents.erase( - this->CurrentSourceDirectoryComponents.begin() + 1, - this->CurrentSourceDirectoryComponents.end()); - this->CurrentBinaryDirectoryComponents.erase( - this->CurrentBinaryDirectoryComponents.begin() + 1, - this->CurrentBinaryDirectoryComponents.end()); - this->RelativePathTopSource.erase(this->RelativePathTopSource.begin() + 1, - this->RelativePathTopSource.end()); - this->RelativePathTopBinary.erase(this->RelativePathTopBinary.begin() + 1, - this->RelativePathTopBinary.end()); + this->BuildsystemDirectory.Truncate(); + PositionType pos = this->SnapshotData.Truncate(); this->DefineProperty ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, @@ -243,6 +246,8 @@ void cmState::Reset() this->DefineProperty ("RULE_LAUNCH_CUSTOM", cmProperty::TARGET, "", "", true); + + return Snapshot(this, pos); } void cmState::DefineProperty(const std::string& name, @@ -256,27 +261,41 @@ void cmState::DefineProperty(const std::string& name, chained); } -cmPropertyDefinition *cmState +cmPropertyDefinition const* cmState ::GetPropertyDefinition(const std::string& name, - cmProperty::ScopeType scope) + cmProperty::ScopeType scope) const { if (this->IsPropertyDefined(name,scope)) { - return &(this->PropertyDefinitions[scope][name]); + cmPropertyDefinitionMap const& defs = + this->PropertyDefinitions.find(scope)->second; + return &defs.find(name)->second; } return 0; } bool cmState::IsPropertyDefined(const std::string& name, - cmProperty::ScopeType scope) + cmProperty::ScopeType scope) const { - return this->PropertyDefinitions[scope].IsPropertyDefined(name); + std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>::const_iterator it + = this->PropertyDefinitions.find(scope); + if (it == this->PropertyDefinitions.end()) + { + return false; + } + return it->second.IsPropertyDefined(name); } bool cmState::IsPropertyChained(const std::string& name, - cmProperty::ScopeType scope) + cmProperty::ScopeType scope) const { - return this->PropertyDefinitions[scope].IsPropertyChained(name); + std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>::const_iterator it + = this->PropertyDefinitions.find(scope); + if (it == this->PropertyDefinitions.end()) + { + return false; + } + return it->second.IsPropertyChained(name); } void cmState::SetLanguageEnabled(std::string const& l) @@ -424,14 +443,13 @@ void cmState::RemoveUserDefinedCommands() void cmState::SetGlobalProperty(const std::string& prop, const char* value) { - this->GlobalProperties.SetProperty(prop, value, cmProperty::GLOBAL); + this->GlobalProperties.SetProperty(prop, value); } void cmState::AppendGlobalProperty(const std::string& prop, const char* value, bool asString) { - this->GlobalProperties.AppendProperty(prop, value, - cmProperty::GLOBAL, asString); + this->GlobalProperties.AppendProperty(prop, value, asString); } const char *cmState::GetGlobalProperty(const std::string& prop) @@ -469,9 +487,7 @@ const char *cmState::GetGlobalProperty(const std::string& prop) return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1; } #undef STRING_LIST_ELEMENT - bool dummy = false; - return this->GlobalProperties.GetPropertyValue(prop, cmProperty::GLOBAL, - dummy); + return this->GlobalProperties.GetPropertyValue(prop); } bool cmState::GetGlobalPropertyAsBool(const std::string& prop) @@ -590,7 +606,7 @@ void cmState::Snapshot::ComputeRelativePathTopSource() snapshots.push_back(snapshot); while (true) { - snapshot = snapshot.GetParent(); + snapshot = snapshot.GetBuildsystemDirectoryParent(); if (snapshot.IsValid()) { snapshots.push_back(snapshot); @@ -612,7 +628,7 @@ void cmState::Snapshot::ComputeRelativePathTopSource() result = currentSource; } } - this->State->RelativePathTopSource[this->Position] = result; + this->Position->BuildSystemDirectory->RelativePathTopSource = result; } void cmState::Snapshot::ComputeRelativePathTopBinary() @@ -622,7 +638,7 @@ void cmState::Snapshot::ComputeRelativePathTopBinary() snapshots.push_back(snapshot); while (true) { - snapshot = snapshot.GetParent(); + snapshot = snapshot.GetBuildsystemDirectoryParent(); if (snapshot.IsValid()) { snapshots.push_back(snapshot); @@ -651,30 +667,34 @@ void cmState::Snapshot::ComputeRelativePathTopBinary() // is a network path. if(result.size() < 2 || result.substr(0, 2) != "//") { - this->State->RelativePathTopBinary[this->Position] = result; + this->Position->BuildSystemDirectory->RelativePathTopBinary = result; } else { - this->State->RelativePathTopBinary[this->Position] = ""; + this->Position->BuildSystemDirectory->RelativePathTopBinary = ""; } } -cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) +cmState::Snapshot cmState::CreateBaseSnapshot() { - if (!originSnapshot.IsValid()) - { - originSnapshot.State = this; - } - PositionType pos = this->ParentPositions.size(); - this->ParentPositions.push_back(originSnapshot.Position); - this->Locations.resize(this->Locations.size() + 1); - this->OutputLocations.resize(this->OutputLocations.size() + 1); - this->CurrentSourceDirectoryComponents.resize( - this->CurrentSourceDirectoryComponents.size() + 1); - this->CurrentBinaryDirectoryComponents.resize( - this->CurrentBinaryDirectoryComponents.size() + 1); - this->RelativePathTopSource.resize(this->RelativePathTopSource.size() + 1); - this->RelativePathTopBinary.resize(this->RelativePathTopBinary.size() + 1); + PositionType pos = this->SnapshotData.Extend(this->SnapshotData.Root()); + pos->DirectoryParent = this->SnapshotData.Root(); + pos->SnapshotType = BuildsystemDirectoryType; + pos->BuildSystemDirectory = + this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root()); + return cmState::Snapshot(this, pos); +} + +cmState::Snapshot +cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot) +{ + assert(originSnapshot.IsValid()); + PositionType pos = this->SnapshotData.Extend(originSnapshot.Position); + pos->DirectoryParent = originSnapshot.Position; + pos->SnapshotType = BuildsystemDirectoryType; + pos->BuildSystemDirectory = + this->BuildsystemDirectory.Extend( + originSnapshot.Position->BuildSystemDirectory); return cmState::Snapshot(this, pos); } @@ -687,92 +707,99 @@ cmState::Snapshot::Snapshot(cmState* state, PositionType position) const char* cmState::Snapshot::GetCurrentSourceDirectory() const { - return this->State->Locations[this->Position].c_str(); + return this->Position->BuildSystemDirectory->Location.c_str(); } void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir) { assert(this->State); - assert(this->State->Locations.size() > this->Position); - this->State->Locations[this->Position] = dir; - cmSystemTools::ConvertToUnixSlashes( - this->State->Locations[this->Position]); - this->State->Locations[this->Position] = - cmSystemTools::CollapseFullPath(this->State->Locations[this->Position]); + std::string& loc = this->Position->BuildSystemDirectory->Location; + loc = dir; + cmSystemTools::ConvertToUnixSlashes(loc); + loc = cmSystemTools::CollapseFullPath(loc); cmSystemTools::SplitPath( - this->State->Locations[this->Position], - this->State->CurrentSourceDirectoryComponents[this->Position]); + loc, + this->Position->BuildSystemDirectory->CurrentSourceDirectoryComponents); this->ComputeRelativePathTopSource(); } const char* cmState::Snapshot::GetCurrentBinaryDirectory() const { - return this->State->OutputLocations[this->Position].c_str(); + return this->Position->BuildSystemDirectory->OutputLocation.c_str(); } void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir) { - assert(this->State->OutputLocations.size() > this->Position); - this->State->OutputLocations[this->Position] = dir; - cmSystemTools::ConvertToUnixSlashes( - this->State->OutputLocations[this->Position]); - this->State->OutputLocations[this->Position] = - cmSystemTools::CollapseFullPath( - this->State->OutputLocations[this->Position]); + std::string& loc = this->Position->BuildSystemDirectory->OutputLocation; + loc = dir; + cmSystemTools::ConvertToUnixSlashes(loc); + loc = cmSystemTools::CollapseFullPath(loc); cmSystemTools::SplitPath( - this->State->OutputLocations[this->Position], - this->State->CurrentBinaryDirectoryComponents[this->Position]); + loc, + this->Position->BuildSystemDirectory->CurrentBinaryDirectoryComponents); this->ComputeRelativePathTopBinary(); } std::vector<std::string> const& -cmState::Snapshot::GetCurrentSourceDirectoryComponents() +cmState::Snapshot::GetCurrentSourceDirectoryComponents() const { - return this->State->CurrentSourceDirectoryComponents[this->Position]; + return this->Position->BuildSystemDirectory + ->CurrentSourceDirectoryComponents; } std::vector<std::string> const& -cmState::Snapshot::GetCurrentBinaryDirectoryComponents() +cmState::Snapshot::GetCurrentBinaryDirectoryComponents() const { - return this->State->CurrentBinaryDirectoryComponents[this->Position]; + return this->Position->BuildSystemDirectory + ->CurrentBinaryDirectoryComponents; } const char* cmState::Snapshot::GetRelativePathTopSource() const { - return this->State->RelativePathTopSource[this->Position].c_str(); + return this->Position->BuildSystemDirectory->RelativePathTopSource.c_str(); } const char* cmState::Snapshot::GetRelativePathTopBinary() const { - return this->State->RelativePathTopBinary[this->Position].c_str(); + return this->Position->BuildSystemDirectory->RelativePathTopBinary.c_str(); } void cmState::Snapshot::SetRelativePathTopSource(const char* dir) { - this->State->RelativePathTopSource[this->Position] = dir; + this->Position->BuildSystemDirectory->RelativePathTopSource = dir; } void cmState::Snapshot::SetRelativePathTopBinary(const char* dir) { - this->State->RelativePathTopBinary[this->Position] = dir; + this->Position->BuildSystemDirectory->RelativePathTopBinary = dir; } bool cmState::Snapshot::IsValid() const { - return this->State ? true : false; + return this->State && this->Position.IsValid() + ? this->Position != this->State->SnapshotData.Root() + : false; } -cmState::Snapshot cmState::Snapshot::GetParent() const +cmState::Snapshot cmState::Snapshot::GetBuildsystemDirectoryParent() const { Snapshot snapshot; - if (!this->State || this->Position == 0) + if (!this->State || this->Position == this->State->SnapshotData.Root()) { return snapshot; } - PositionType parentPos = this->State->ParentPositions[this->Position]; - snapshot = Snapshot(this->State, parentPos); + PositionType parentPos = this->Position->DirectoryParent; + if (parentPos != this->State->SnapshotData.Root()) + { + snapshot = Snapshot(this->State, parentPos); + } return snapshot; } + +cmState* cmState::Snapshot::GetState() const +{ + return this->State; +} diff --git a/Source/cmState.h b/Source/cmState.h index 77a066f..9c7574f 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -15,29 +15,38 @@ #include "cmStandardIncludes.h" #include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" +#include "cmLinkedTree.h" class cmake; class cmCommand; class cmState { - typedef std::vector<std::string>::size_type PositionType; + struct SnapshotDataType; + typedef cmLinkedTree<SnapshotDataType>::iterator PositionType; friend class Snapshot; public: cmState(cmake* cm); ~cmState(); + enum SnapshotType + { + BuildsystemDirectoryType + }; + class Snapshot { public: - Snapshot(cmState* state = 0, PositionType position = 0); + Snapshot(cmState* state = 0, PositionType position = PositionType()); const char* GetCurrentSourceDirectory() const; void SetCurrentSourceDirectory(std::string const& dir); const char* GetCurrentBinaryDirectory() const; void SetCurrentBinaryDirectory(std::string const& dir); - std::vector<std::string> const& GetCurrentSourceDirectoryComponents(); - std::vector<std::string> const& GetCurrentBinaryDirectoryComponents(); + std::vector<std::string> const& + GetCurrentSourceDirectoryComponents() const; + std::vector<std::string> const& + GetCurrentBinaryDirectoryComponents() const; const char* GetRelativePathTopSource() const; const char* GetRelativePathTopBinary() const; @@ -45,7 +54,9 @@ public: void SetRelativePathTopBinary(const char* dir); bool IsValid() const; - Snapshot GetParent() const; + Snapshot GetBuildsystemDirectoryParent() const; + + cmState* GetState() const; private: void ComputeRelativePathTopSource(); @@ -57,7 +68,8 @@ public: cmState::PositionType Position; }; - Snapshot CreateSnapshot(Snapshot originSnapshot); + Snapshot CreateBaseSnapshot(); + Snapshot CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot); enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, UNINITIALIZED }; @@ -93,7 +105,7 @@ public: void RemoveCacheEntryProperty(std::string const& key, std::string const& propertyName); - void Reset(); + Snapshot Reset(); // Define a property void DefineProperty(const std::string& name, cmProperty::ScopeType scope, const char *ShortDescription, @@ -101,12 +113,14 @@ public: bool chain = false); // get property definition - cmPropertyDefinition *GetPropertyDefinition - (const std::string& name, cmProperty::ScopeType scope); + cmPropertyDefinition const* GetPropertyDefinition + (const std::string& name, cmProperty::ScopeType scope) const; // Is a property defined? - bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope); - bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope); + bool IsPropertyDefined(const std::string& name, + cmProperty::ScopeType scope) const; + bool IsPropertyChained(const std::string& name, + cmProperty::ScopeType scope) const; void SetLanguageEnabled(std::string const& l); bool GetLanguageEnabled(std::string const& l) const; @@ -157,19 +171,11 @@ private: std::map<std::string, cmCommand*> Commands; cmPropertyMap GlobalProperties; cmake* CMakeInstance; - std::vector<std::string> Locations; - std::vector<std::string> OutputLocations; - std::vector<PositionType> ParentPositions; - - std::vector<std::vector<std::string> > CurrentSourceDirectoryComponents; - std::vector<std::vector<std::string> > CurrentBinaryDirectoryComponents; - // The top-most directories for relative path conversion. Both the - // source and destination location of a relative path conversion - // must be underneath one of these directories (both under source or - // both under binary) in order for the relative path to be evaluated - // safely by the build tools. - std::vector<std::string> RelativePathTopSource; - std::vector<std::string> RelativePathTopBinary; + + struct BuildsystemDirectoryStateType; + cmLinkedTree<BuildsystemDirectoryStateType> BuildsystemDirectory; + + cmLinkedTree<SnapshotDataType> SnapshotData; std::vector<std::string> SourceDirectoryComponents; std::vector<std::string> BinaryDirectoryComponents; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 70005b4..4b031bc 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -13,7 +13,7 @@ #include "cmake.h" #include "cmMakefile.h" #include "cmSourceFile.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmGlobalGenerator.h" #include "cmComputeLinkInformation.h" #include "cmListFileCache.h" @@ -94,13 +94,13 @@ class cmTargetInternals { public: cmTargetInternals() - : Backtrace(NULL) + : Backtrace() { this->PolicyWarnedCMP0022 = false; this->UtilityItemsDone = false; } cmTargetInternals(cmTargetInternals const&) - : Backtrace(NULL) + : Backtrace() { this->PolicyWarnedCMP0022 = false; this->UtilityItemsDone = false; @@ -239,13 +239,6 @@ cmTargetInternals::~cmTargetInternals() //---------------------------------------------------------------------------- cmTarget::cmTarget() { -#define INITIALIZE_TARGET_POLICY_MEMBER(POLICY) \ - this->PolicyStatus ## POLICY = cmPolicies::WARN; - - CM_FOR_EACH_TARGET_POLICY(INITIALIZE_TARGET_POLICY_MEMBER) - -#undef INITIALIZE_TARGET_POLICY_MEMBER - this->Makefile = 0; #if defined(_WIN32) && !defined(__CYGWIN__) this->LinkLibrariesForVS6Analyzed = false; @@ -286,9 +279,6 @@ void cmTarget::SetMakefile(cmMakefile* mf) // Set our makefile. this->Makefile = mf; - // set the cmake instance of the properties - this->Properties.SetCMakeInstance(mf->GetCMakeInstance()); - // Check whether this is a DLL platform. this->DLLPlatform = (this->Makefile->IsOn("WIN32") || this->Makefile->IsOn("CYGWIN") || @@ -333,10 +323,12 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SetPropertyDefault("MACOSX_BUNDLE", 0); this->SetPropertyDefault("MACOSX_RPATH", 0); this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", 0); + this->SetPropertyDefault("C_COMPILER_LAUNCHER", 0); this->SetPropertyDefault("C_INCLUDE_WHAT_YOU_USE", 0); this->SetPropertyDefault("C_STANDARD", 0); this->SetPropertyDefault("C_STANDARD_REQUIRED", 0); this->SetPropertyDefault("C_EXTENSIONS", 0); + this->SetPropertyDefault("CXX_COMPILER_LAUNCHER", 0); this->SetPropertyDefault("CXX_INCLUDE_WHAT_YOU_USE", 0); this->SetPropertyDefault("CXX_STANDARD", 0); this->SetPropertyDefault("CXX_STANDARD_REQUIRED", 0); @@ -443,20 +435,14 @@ void cmTarget::SetMakefile(cmMakefile* mf) } // Record current policies for later use. -#define CAPTURE_TARGET_POLICY(POLICY) \ - this->PolicyStatus ## POLICY = \ - this->Makefile->GetPolicyStatus(cmPolicies::POLICY); - - CM_FOR_EACH_TARGET_POLICY(CAPTURE_TARGET_POLICY) - -#undef CAPTURE_TARGET_POLICY + this->Makefile->RecordPolicies(this->PolicyMap); if (this->TargetTypeValue == INTERFACE_LIBRARY) { // This policy is checked in a few conditions. The properties relevant // to the policy are always ignored for INTERFACE_LIBRARY targets, // so ensure that the conditions don't lead to nonsense. - this->PolicyStatusCMP0022 = cmPolicies::NEW; + this->PolicyMap.Set(cmPolicies::CMP0022, cmPolicies::NEW); } if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY) @@ -764,7 +750,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, "SOURCES") != debugProperties.end(); - if (this->Makefile->IsGeneratingBuildSystem()) + if (this->Makefile->IsConfigured()) { this->DebugSourcesDone = true; } @@ -1231,7 +1217,8 @@ static std::string targetNameGenex(const std::string& lib) } //---------------------------------------------------------------------------- -bool cmTarget::PushTLLCommandTrace(TLLSignature signature) +bool cmTarget::PushTLLCommandTrace(TLLSignature signature, + cmListFileContext const& lfc) { bool ret = true; if (!this->TLLCommands.empty()) @@ -1241,7 +1228,6 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature) ret = false; } } - cmListFileContext lfc = this->Makefile->GetExecutionContext(); if (this->TLLCommands.empty() || this->TLLCommands.back().second != lfc) { this->TLLCommands.push_back(std::make_pair(signature, lfc)); @@ -1257,14 +1243,14 @@ void cmTarget::GetTllSignatureTraces(std::ostringstream &s, : "plain"); s << "The uses of the " << sigString << " signature are here:\n"; typedef std::vector<std::pair<TLLSignature, cmListFileContext> > Container; - cmLocalGenerator* lg = this->GetMakefile()->GetLocalGenerator(); + cmOutputConverter converter(this->GetMakefile()->GetStateSnapshot()); for(Container::const_iterator it = this->TLLCommands.begin(); it != this->TLLCommands.end(); ++it) { if (it->first == sig) { cmListFileContext lfc = it->second; - lfc.FilePath = lg->Convert(lfc.FilePath, cmLocalGenerator::HOME); + lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME); s << " * " << lfc << std::endl; } } @@ -1772,7 +1758,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) } else { - this->Properties.SetProperty(prop, value, cmProperty::TARGET); + this->Properties.SetProperty(prop, value); this->MaybeInvalidatePropertyCache(prop); } } @@ -1857,7 +1843,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, } else { - this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString); + this->Properties.AppendProperty(prop, value, asString); this->MaybeInvalidatePropertyCache(prop); } } @@ -2106,7 +2092,7 @@ cmTarget::GetIncludeDirectories(const std::string& config, "INCLUDE_DIRECTORIES") != debugProperties.end(); - if (this->Makefile->IsGeneratingBuildSystem()) + if (this->Makefile->IsConfigured()) { this->DebugIncludesDone = true; } @@ -2277,7 +2263,7 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result, "COMPILE_OPTIONS") != debugProperties.end(); - if (this->Makefile->IsGeneratingBuildSystem()) + if (this->Makefile->IsConfigured()) { this->DebugCompileOptionsDone = true; } @@ -2348,7 +2334,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list, "COMPILE_DEFINITIONS") != debugProperties.end(); - if (this->Makefile->IsGeneratingBuildSystem()) + if (this->Makefile->IsConfigured()) { this->DebugCompileDefinitionsDone = true; } @@ -2449,7 +2435,7 @@ void cmTarget::GetCompileFeatures(std::vector<std::string> &result, "COMPILE_FEATURES") != debugProperties.end(); - if (this->Makefile->IsGeneratingBuildSystem()) + if (this->Makefile->IsConfigured()) { this->DebugCompileFeaturesDone = true; } @@ -2814,34 +2800,6 @@ void cmTarget::GetTargetVersion(bool soversion, } //---------------------------------------------------------------------------- -const char* cmTarget::GetFeature(const std::string& feature, - const std::string& config) const -{ - if(!config.empty()) - { - std::string featureConfig = feature; - featureConfig += "_"; - featureConfig += cmSystemTools::UpperCase(config); - if(const char* value = this->GetProperty(featureConfig)) - { - return value; - } - } - if(const char* value = this->GetProperty(feature)) - { - return value; - } - return this->Makefile->GetFeature(feature, config); -} - -//---------------------------------------------------------------------------- -bool cmTarget::GetFeatureAsBool(const std::string& feature, - const std::string& config) const -{ - return cmSystemTools::IsOn(this->GetFeature(feature, config)); -} - -//---------------------------------------------------------------------------- bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const { if (this->IsImported()) @@ -2938,8 +2896,7 @@ const char *cmTarget::GetProperty(const std::string& prop, // cannot take into account the per-configuration name of the // target because the configuration type may not be known at // CMake time. - this->Properties.SetProperty(propLOCATION, this->GetLocationForBuild(), - cmProperty::TARGET); + this->Properties.SetProperty(propLOCATION, this->GetLocationForBuild()); } // Support "LOCATION_<CONFIG>". @@ -2950,9 +2907,7 @@ const char *cmTarget::GetProperty(const std::string& prop, return 0; } const char* configName = prop.c_str() + 9; - this->Properties.SetProperty(prop, - this->GetLocation(configName), - cmProperty::TARGET); + this->Properties.SetProperty(prop, this->GetLocation(configName)); } // Support "<CONFIG>_LOCATION". else if(cmHasLiteralSuffix(prop, "_LOCATION")) @@ -2964,9 +2919,7 @@ const char *cmTarget::GetProperty(const std::string& prop, { return 0; } - this->Properties.SetProperty(prop, - this->GetLocation(configName), - cmProperty::TARGET); + this->Properties.SetProperty(prop, this->GetLocation(configName)); } } } @@ -3168,17 +3121,19 @@ const char *cmTarget::GetProperty(const std::string& prop, } } } - this->Properties.SetProperty("SOURCES", ss.str().c_str(), - cmProperty::TARGET); + this->Properties.SetProperty("SOURCES", ss.str().c_str()); } } - bool chain = false; - const char *retVal = - this->Properties.GetPropertyValue(prop, cmProperty::TARGET, chain); - if (chain) + const char *retVal = this->Properties.GetPropertyValue(prop); + if (!retVal) { - return this->Makefile->GetProperty(prop, cmProperty::TARGET); + const bool chain = this->GetMakefile()->GetState()-> + IsPropertyChained(prop, cmProperty::TARGET); + if (chain) + { + return this->Makefile->GetProperty(prop, chain); + } } return retVal; } @@ -4857,7 +4812,7 @@ cmTarget::ReportPropertyOrigin(const std::string &p, p) != debugProperties.end(); - if (this->Makefile->IsGeneratingBuildSystem()) + if (this->Makefile->IsConfigured()) { this->DebugCompatiblePropertiesDone[p] = true; } @@ -5931,8 +5886,8 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( // libraries and executables that export symbols. const char* explicitLibraries = 0; std::string linkIfaceProp; - if(thisTarget->PolicyStatusCMP0022 != cmPolicies::OLD && - thisTarget->PolicyStatusCMP0022 != cmPolicies::WARN) + if(thisTarget->GetPolicyStatusCMP0022() != cmPolicies::OLD && + thisTarget->GetPolicyStatusCMP0022() != cmPolicies::WARN) { // CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES. linkIfaceProp = "INTERFACE_LINK_LIBRARIES"; @@ -5958,7 +5913,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( } if(explicitLibraries && - thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN && + thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN && !this->PolicyWarnedCMP0022) { // Compare the explicitly set old link interface properties to the @@ -6002,8 +5957,8 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( iface.Libraries, iface.HadHeadSensitiveCondition); } - else if (thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN - || thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD) + else if (thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN + || thisTarget->GetPolicyStatusCMP0022() == cmPolicies::OLD) // If CMP0022 is NEW then the plain tll signature sets the // INTERFACE_LINK_LIBRARIES, so if we get here then the project // cleared the property explicitly and we should not fall back @@ -6014,7 +5969,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget); iface.Libraries.insert(iface.Libraries.end(), impl->Libraries.begin(), impl->Libraries.end()); - if(thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN && + if(thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN && !this->PolicyWarnedCMP0022 && !usage_requirements_only) { // Compare the link implementation fallback link interface to the @@ -6106,8 +6061,8 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, } } } - else if (thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN - || thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD) + else if (thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN + || thisTarget->GetPolicyStatusCMP0022() == cmPolicies::OLD) { // The link implementation is the default link interface. cmTarget::LinkImplementationLibraries const* @@ -6427,7 +6382,7 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const if(lib != item) { cmake* cm = this->Makefile->GetCMakeInstance(); - switch(this->PolicyStatusCMP0004) + switch(this->GetPolicyStatusCMP0004()) { case cmPolicies::WARN: { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 2150b83..1920312 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -66,7 +66,7 @@ public: class cmLinkImplItem: public cmLinkItem { public: - cmLinkImplItem(): cmLinkItem(), Backtrace(0), FromGenex(false) {} + cmLinkImplItem(): cmLinkItem(), Backtrace(), FromGenex(false) {} cmLinkImplItem(std::string const& n, cmTarget const* t, cmListFileBacktrace const& bt, @@ -144,7 +144,7 @@ public: #define DECLARE_TARGET_POLICY(POLICY) \ cmPolicies::PolicyStatus GetPolicyStatus ## POLICY () const \ - { return this->PolicyStatus ## POLICY; } + { return this->PolicyMap.Get(cmPolicies::POLICY); } CM_FOR_EACH_TARGET_POLICY(DECLARE_TARGET_POLICY) @@ -207,7 +207,8 @@ public: KeywordTLLSignature, PlainTLLSignature }; - bool PushTLLCommandTrace(TLLSignature signature); + bool PushTLLCommandTrace(TLLSignature signature, + cmListFileContext const& lfc); void GetTllSignatureTraces(std::ostringstream &s, TLLSignature sig) const; void MergeLinkLibraries( cmMakefile& mf, const std::string& selfname, @@ -260,11 +261,6 @@ public: bool GetPropertyAsBool(const std::string& prop) const; void CheckProperty(const std::string& prop, cmMakefile* context) const; - const char* GetFeature(const std::string& feature, - const std::string& config) const; - bool GetFeatureAsBool(const std::string& feature, - const std::string& config) const; - bool IsImported() const {return this->IsImportedTarget;} void GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const; @@ -642,12 +638,6 @@ public: private: bool HandleLocationPropertyPolicy(cmMakefile* context) const; - // The set of include directories that are marked as system include - // directories. - std::set<std::string> SystemIncludeDirectories; - - std::vector<std::pair<TLLSignature, cmListFileContext> > TLLCommands; - #if defined(_WIN32) && !defined(__CYGWIN__) /** * A list of direct dependencies. Use in conjunction with DependencyMap. @@ -742,40 +732,48 @@ private: void GetSourceFiles(std::vector<std::string> &files, const std::string& config) const; private: + mutable cmPropertyMap Properties; + std::set<std::string> SystemIncludeDirectories; + std::set<std::string> LinkDirectoriesEmmitted; + std::set<std::string> Utilities; + mutable std::set<std::string> LinkImplicitNullProperties; + std::map<std::string, cmListFileBacktrace> UtilityBacktraces; + mutable std::map<std::string, bool> DebugCompatiblePropertiesDone; + mutable std::map<std::string, std::string> MaxLanguageStandards; + cmPolicies::PolicyMap PolicyMap; std::string Name; + std::string InstallPath; + std::string RuntimeInstallPath; + mutable std::string ExportMacro; + std::vector<std::string> LinkDirectories; std::vector<cmCustomCommand> PreBuildCommands; std::vector<cmCustomCommand> PreLinkCommands; std::vector<cmCustomCommand> PostBuildCommands; - TargetType TargetTypeValue; + std::vector<std::pair<TLLSignature, cmListFileContext> > TLLCommands; LinkLibraryVectorType PrevLinkedLibraries; + LinkLibraryVectorType OriginalLinkLibraries; #if defined(_WIN32) && !defined(__CYGWIN__) LinkLibraryVectorType LinkLibrariesForVS6; - bool LinkLibrariesForVS6Analyzed; #endif - std::vector<std::string> LinkDirectories; - std::set<std::string> LinkDirectoriesEmmitted; + cmMakefile* Makefile; + cmTargetInternalPointer Internal; + TargetType TargetTypeValue; bool HaveInstallRule; - std::string InstallPath; - std::string RuntimeInstallPath; - mutable std::string ExportMacro; - std::set<std::string> Utilities; - std::map<std::string, cmListFileBacktrace> UtilityBacktraces; bool RecordDependencies; - mutable cmPropertyMap Properties; - LinkLibraryVectorType OriginalLinkLibraries; bool DLLPlatform; bool IsAndroid; bool IsApple; bool IsImportedTarget; + bool BuildInterfaceIncludesAppended; mutable bool DebugIncludesDone; - mutable std::map<std::string, bool> DebugCompatiblePropertiesDone; mutable bool DebugCompileOptionsDone; mutable bool DebugCompileDefinitionsDone; mutable bool DebugSourcesDone; mutable bool DebugCompileFeaturesDone; - mutable std::set<std::string> LinkImplicitNullProperties; - mutable std::map<std::string, std::string> MaxLanguageStandards; - bool BuildInterfaceIncludesAppended; + mutable bool LinkImplementationLanguageIsContextDependent; +#if defined(_WIN32) && !defined(__CYGWIN__) + bool LinkLibrariesForVS6Analyzed; +#endif // Cache target output paths for each configuration. struct OutputInfo; @@ -825,23 +823,10 @@ private: void ProcessSourceExpression(std::string const& expr); - // The cmMakefile instance that owns this target. This should - // always be set. - cmMakefile* Makefile; - - // Policy status recorded when target was created. -#define TARGET_POLICY_MEMBER(POLICY) \ - cmPolicies::PolicyStatus PolicyStatus ## POLICY; - - CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_MEMBER) - -#undef TARGET_POLICY_MEMBER - // Internal representation details. friend class cmTargetInternals; friend class cmGeneratorTarget; friend class cmTargetTraceDependencies; - cmTargetInternalPointer Internal; void ComputeVersionedName(std::string& vName, std::string const& prefix, @@ -849,8 +834,6 @@ private: std::string const& suffix, std::string const& name, const char* version) const; - - mutable bool LinkImplementationLanguageIsContextDependent; }; #ifdef CMAKE_BUILD_WITH_CMAKE diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index df37d66..b57b921 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -368,7 +368,8 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, || this->CurrentProcessingState == ProcessingKeywordPublicInterface || this->CurrentProcessingState == ProcessingKeywordLinkInterface) ? cmTarget::KeywordTLLSignature : cmTarget::PlainTLLSignature; - if (!this->Target->PushTLLCommandTrace(sig)) + if (!this->Target->PushTLLCommandTrace( + sig, this->Makefile->GetExecutionContext())) { std::ostringstream e; const char *modal = 0; diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index ff5d411..6fcd0dc 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -21,7 +21,6 @@ cmTest::cmTest(cmMakefile* mf) { this->Makefile = mf; this->OldStyle = true; - this->Properties.SetCMakeInstance(mf->GetCMakeInstance()); } //---------------------------------------------------------------------------- @@ -50,12 +49,15 @@ void cmTest::SetCommand(std::vector<std::string> const& command) //---------------------------------------------------------------------------- const char *cmTest::GetProperty(const std::string& prop) const { - bool chain = false; - const char *retVal = - this->Properties.GetPropertyValue(prop, cmProperty::TEST, chain); - if (chain) + const char *retVal = this->Properties.GetPropertyValue(prop); + if (!retVal) { - return this->Makefile->GetProperty(prop,cmProperty::TEST); + const bool chain = this->Makefile->GetState()-> + IsPropertyChained(prop, cmProperty::TEST); + if (chain) + { + return this->Makefile->GetProperty(prop, chain); + } } return retVal; } @@ -69,12 +71,12 @@ bool cmTest::GetPropertyAsBool(const std::string& prop) const //---------------------------------------------------------------------------- void cmTest::SetProperty(const std::string& prop, const char* value) { - this->Properties.SetProperty(prop, value, cmProperty::TEST); + this->Properties.SetProperty(prop, value); } //---------------------------------------------------------------------------- void cmTest::AppendProperty(const std::string& prop, const char* value, bool asString) { - this->Properties.AppendProperty(prop, value, cmProperty::TEST, asString); + this->Properties.AppendProperty(prop, value, asString); } diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 7e11d8c..546ad71 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -12,7 +12,7 @@ #include "cmTestGenerator.h" #include "cmGeneratorExpression.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmMakefile.h" #include "cmSystemTools.h" #include "cmTarget.h" @@ -97,13 +97,13 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs); std::string emulatorExe(emulatorWithArgs[0]); cmSystemTools::ConvertToUnixSlashes(emulatorExe); - os << cmLocalGenerator::EscapeForCMake(emulatorExe) << " "; + os << cmOutputConverter::EscapeForCMake(emulatorExe) << " "; for(std::vector<std::string>::const_iterator ei = emulatorWithArgs.begin()+1; ei != emulatorWithArgs.end(); ++ei) { - os << cmLocalGenerator::EscapeForCMake(*ei) << " "; + os << cmOutputConverter::EscapeForCMake(*ei) << " "; } } } @@ -115,11 +115,11 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, } // Generate the command line with full escapes. - os << cmLocalGenerator::EscapeForCMake(exe); + os << cmOutputConverter::EscapeForCMake(exe); for(std::vector<std::string>::const_iterator ci = command.begin()+1; ci != command.end(); ++ci) { - os << " " << cmLocalGenerator::EscapeForCMake( + os << " " << cmOutputConverter::EscapeForCMake( ge.Parse(*ci)->Evaluate(mf, config)); } @@ -136,7 +136,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, i != pm.end(); ++i) { os << " " << i->first - << " " << cmLocalGenerator::EscapeForCMake( + << " " << cmOutputConverter::EscapeForCMake( ge.Parse(i->second.GetValue())->Evaluate(mf, config)); } os << ")" << std::endl; @@ -206,7 +206,7 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, i != pm.end(); ++i) { fout << " " << i->first - << " " << cmLocalGenerator::EscapeForCMake(i->second.GetValue()); + << " " << cmOutputConverter::EscapeForCMake(i->second.GetValue()); } fout << ")" << std::endl; } diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index 9473008..6521c04 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -49,30 +49,27 @@ static void cmVariableWatchCommandVariableAccessed( newLFF.Arguments.clear(); newLFF.Arguments.push_back( cmListFileArgument(variable, cmListFileArgument::Quoted, - "unknown", 9999)); + 9999)); newLFF.Arguments.push_back( cmListFileArgument(accessString, cmListFileArgument::Quoted, - "unknown", 9999)); + 9999)); newLFF.Arguments.push_back( cmListFileArgument(newValue?newValue:"", cmListFileArgument::Quoted, - "unknown", 9999)); + 9999)); newLFF.Arguments.push_back( cmListFileArgument(currentListFile, cmListFileArgument::Quoted, - "unknown", 9999)); + 9999)); newLFF.Arguments.push_back( cmListFileArgument(stack, cmListFileArgument::Quoted, - "unknown", 9999)); + 9999)); newLFF.Name = data->Command; - newLFF.FilePath = "Some weird path"; + newLFF.FilePath = "unknown"; newLFF.Line = 9999; cmExecutionStatus status; if(!makefile->ExecuteCommand(newLFF,status)) { - arg.FilePath = "Unknown"; - arg.Line = 0; std::ostringstream error; - error << "Error in cmake code at\n" - << arg.FilePath << ":" << arg.Line << ":\n" + error << "Error in cmake code at\nUnknown:0:\n" << "A command failed during the invocation of callback \"" << data->Command << "\"."; cmSystemTools::Error(error.str().c_str()); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 5dfdb14..12a1e42 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -176,9 +176,8 @@ cmVisualStudio10TargetGenerator(cmTarget* target, this->Makefile->GetConfigurations(this->Configurations); this->LocalGenerator = (cmLocalVisualStudio7Generator*) - this->Makefile->GetLocalGenerator(); + this->GeneratorTarget->GetLocalGenerator(); this->Name = this->Target->GetName(); - this->GlobalGenerator->CreateGUID(this->Name.c_str()); this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str()); this->Platform = gg->GetPlatformName(); this->NsightTegra = gg->IsNsightTegra(); @@ -923,10 +922,7 @@ cmVisualStudio10TargetGenerator::ConvertPath(std::string const& path, return forceRelative ? cmSystemTools::RelativePath( this->Makefile->GetCurrentBinaryDirectory(), path.c_str()) - : this->LocalGenerator->Convert(path.c_str(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::UNCHANGED, - /* optional = */ true); + : path.c_str(); } void cmVisualStudio10TargetGenerator::ConvertToWindowsSlash(std::string& s) @@ -1084,7 +1080,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups() (*this->BuildFileStream) << name << "\">\n"; std::string guidName = "SG_Filter_"; guidName += name; - this->GlobalGenerator->CreateGUID(guidName.c_str()); this->WriteString("<UniqueIdentifier>", 3); std::string guid = this->GlobalGenerator->GetGUID(guidName.c_str()); @@ -1099,7 +1094,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups() { this->WriteString("<Filter Include=\"Object Libraries\">\n", 2); std::string guidName = "SG_Filter_Object Libraries"; - this->GlobalGenerator->CreateGUID(guidName.c_str()); this->WriteString("<UniqueIdentifier>", 3); std::string guid = this->GlobalGenerator->GetGUID(guidName.c_str()); @@ -1112,7 +1106,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups() { this->WriteString("<Filter Include=\"Resource Files\">\n", 2); std::string guidName = "SG_Filter_Resource Files"; - this->GlobalGenerator->CreateGUID(guidName.c_str()); this->WriteString("<UniqueIdentifier>", 3); std::string guid = this->GlobalGenerator->GetGUID(guidName.c_str()); diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index 5170ead..012c580 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -12,6 +12,17 @@ #include "cmWhileCommand.h" #include "cmConditionEvaluator.h" +cmWhileFunctionBlocker::cmWhileFunctionBlocker(cmMakefile* mf): + Makefile(mf), Depth(0) +{ + this->Makefile->PushLoopBlock(); +} + +cmWhileFunctionBlocker::~cmWhileFunctionBlocker() +{ + this->Makefile->PopLoopBlock(); +} + bool cmWhileFunctionBlocker:: IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmExecutionStatus &inStatus) @@ -27,8 +38,6 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, // if this is the endwhile for this while loop then execute if (!this->Depth) { - cmMakefile::LoopBlockPop loopBlockPop(&mf); - // Remove the function blocker for this scope or bail. cmsys::auto_ptr<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(this, lff)); @@ -140,12 +149,10 @@ bool cmWhileCommand } // create a function blocker - cmWhileFunctionBlocker *f = new cmWhileFunctionBlocker(); + cmWhileFunctionBlocker *f = new cmWhileFunctionBlocker(this->Makefile); f->Args = args; this->Makefile->AddFunctionBlocker(f); - this->Makefile->PushLoopBlock(); - return true; } diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h index 9fafffc..85a0bd3 100644 --- a/Source/cmWhileCommand.h +++ b/Source/cmWhileCommand.h @@ -19,8 +19,8 @@ class cmWhileFunctionBlocker : public cmFunctionBlocker { public: - cmWhileFunctionBlocker() {this->Depth=0;} - virtual ~cmWhileFunctionBlocker() {} + cmWhileFunctionBlocker(cmMakefile* mf); + ~cmWhileFunctionBlocker(); virtual bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmExecutionStatus &); @@ -29,6 +29,7 @@ public: std::vector<cmListFileArgument> Args; std::vector<cmListFileFunction> Functions; private: + cmMakefile* Makefile; int Depth; }; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 23803ef..0570399 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -134,7 +134,7 @@ cmake::cmake() this->Policies = new cmPolicies(); this->State = new cmState(this); - this->CurrentSnapshot = this->State->CreateSnapshot(cmState::Snapshot()); + this->CurrentSnapshot = this->State->CreateBaseSnapshot(); #ifdef __APPLE__ struct rlimit rlp; @@ -186,7 +186,7 @@ cmake::~cmake() void cmake::CleanupCommandsAndMacros() { - this->State->Reset(); + this->CurrentSnapshot = this->State->Reset(); this->State->RemoveUserDefinedCommands(); } @@ -370,6 +370,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args, // read in the list file to fill the cache if(path) { + this->CurrentSnapshot = this->State->Reset(); std::string homeDir = this->GetHomeDirectory(); std::string homeOutputDir = this->GetHomeOutputDirectory(); this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); @@ -482,7 +483,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args) std::string linkPath; std::string flags; std::string linkFlags; - gg->CreateGeneratorTargets(mf); + gg->CreateGeneratorTargets(lg.get()); cmGeneratorTarget *gtgt = gg->GetGeneratorTarget(tgt); lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags, gtgt, false); @@ -1437,20 +1438,6 @@ int cmake::ActualConfigure() cmState::PATH); } } - if(!this->State - ->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS")) - { - this->State->AddCacheEntry - ("CMAKE_USE_RELATIVE_PATHS", "OFF", - "If true, cmake will use relative paths in makefiles and projects.", - cmState::BOOL); - if (!this->State->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", - "ADVANCED")) - { - this->State->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", - "ADVANCED", "1"); - } - } if(cmSystemTools::GetFatalErrorOccured()) { @@ -2519,7 +2506,6 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, cmListFileBacktrace const& bt) { cmListFileBacktrace backtrace = bt; - backtrace.MakeRelative(); std::ostringstream msg; if (!this->PrintMessagePreamble(t, msg)) diff --git a/Source/cmake.h b/Source/cmake.h index 12b7e68..f0f9411 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -222,9 +222,6 @@ class cmake ///! this is called by generators to update the progress void UpdateProgress(const char *msg, float prog); - ///! get the cmake policies instance - cmPolicies *GetPolicies() {return this->Policies;} - ///! Get the variable watch object cmVariableWatch* GetVariableWatch() { return this->VariableWatch; } @@ -301,7 +298,7 @@ class cmake /** Display a message to the user. */ void IssueMessage(cmake::MessageType t, std::string const& text, - cmListFileBacktrace const& backtrace = cmListFileBacktrace(NULL)); + cmListFileBacktrace const& backtrace = cmListFileBacktrace()); void IssueMessage(cmake::MessageType t, std::string const& text, cmListFileContext const& lfc); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index e5f4700..c94ffec 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -113,12 +113,7 @@ static cmMakefile* cmakemainGetMakefile(void *clientdata) cmGlobalGenerator* gg=cm->GetGlobalGenerator(); if (gg) { - cmLocalGenerator* lg=gg->GetCurrentLocalGenerator(); - if (lg) - { - cmMakefile* mf = lg->GetMakefile(); - return mf; - } + return gg->GetCurrentMakefile(); } } return 0; @@ -425,7 +420,7 @@ static int do_build(int ac, char const* const* av) switch (doing) { case DoingDir: - dir = av[i]; + dir = cmSystemTools::CollapseFullPath(av[i]); doing = DoingNone; break; case DoingTarget: diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index c88e888..7eb678b 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -786,6 +786,15 @@ IF(KWSYS_USE_SystemInformation) SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY COMPILE_DEFINITIONS KWSYS_BUILD_SHARED=1) ENDIF() + + IF(UNIX AND NOT CYGWIN) + KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_GETLOADAVG + "Checking whether CXX compiler has getloadavg" DIRECT) + IF(KWSYS_CXX_HAS_GETLOADAVG) + SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_CXX_HAS_GETLOADAVG=1) + ENDIF() + ENDIF() ENDIF() #----------------------------------------------------------------------------- diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index b0434f4..6e81b0b 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -81,6 +81,11 @@ typedef int siginfo_t; # include <errno.h> // extern int errno; #endif +#if defined (__CYGWIN__) && !defined(_WIN32) +# include <windows.h> +# undef _WIN32 +#endif + #ifdef __FreeBSD__ # include <sys/sysctl.h> # include <fenv.h> @@ -366,6 +371,8 @@ public: const char *procLimitEnvVarName); LongLong GetProcMemoryUsed(); + double GetLoadAverage(); + // enable/disable stack trace signal handler. static void SetStackTraceOnError(int enable); @@ -820,6 +827,11 @@ SystemInformation::LongLong SystemInformation::GetProcMemoryUsed() return this->Implementation->GetProcMemoryUsed(); } +double SystemInformation::GetLoadAverage() +{ + return this->Implementation->GetLoadAverage(); +} + SystemInformation::LongLong SystemInformation::GetProcessId() { return this->Implementation->GetProcessId(); @@ -1490,6 +1502,60 @@ void SymbolProperties::Initialize(void *address) } #endif // don't define this class if we're not using it +// -------------------------------------------------------------------------- +#if defined(_WIN32) || defined(__CYGWIN__) +# define KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes +#endif +#if defined(_MSC_VER) && _MSC_VER < 1310 +# undef KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes +#endif +#if defined(KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes) +double calculateCPULoad(unsigned __int64 idleTicks, + unsigned __int64 totalTicks) +{ + static double previousLoad = -0.0; + static unsigned __int64 previousIdleTicks = 0; + static unsigned __int64 previousTotalTicks = 0; + + unsigned __int64 const idleTicksSinceLastTime = + idleTicks - previousIdleTicks; + unsigned __int64 const totalTicksSinceLastTime = + totalTicks - previousTotalTicks; + + double load; + if (previousTotalTicks == 0 || totalTicksSinceLastTime == 0) + { + // No new information. Use previous result. + load = previousLoad; + } + else + { + // Calculate load since last time. + load = 1.0 - double(idleTicksSinceLastTime) / totalTicksSinceLastTime; + + // Smooth if possible. + if (previousLoad > 0) + { + load = 0.25 * load + 0.75 * previousLoad; + } + } + + previousLoad = load; + previousIdleTicks = idleTicks; + previousTotalTicks = totalTicks; + + return load; +} + +unsigned __int64 fileTimeToUInt64(FILETIME const& ft) +{ + LARGE_INTEGER out; + out.HighPart = ft.dwHighDateTime; + out.LowPart = ft.dwLowDateTime; + return out.QuadPart; +} +#endif + } // anonymous namespace @@ -3612,6 +3678,38 @@ SystemInformationImplementation::GetProcMemoryUsed() #endif } +double SystemInformationImplementation::GetLoadAverage() +{ +#if defined(KWSYS_CXX_HAS_GETLOADAVG) + double loadavg[3] = { 0.0, 0.0, 0.0 }; + if (getloadavg(loadavg, 3) > 0) + { + return loadavg[0]; + } + return -0.0; +#elif defined(KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes) + // Old windows.h headers do not provide GetSystemTimes. + typedef BOOL (WINAPI *GetSystemTimesType)(LPFILETIME, LPFILETIME, + LPFILETIME); + static GetSystemTimesType pGetSystemTimes = + (GetSystemTimesType)GetProcAddress(GetModuleHandleW(L"kernel32"), + "GetSystemTimes"); + FILETIME idleTime, kernelTime, userTime; + if (pGetSystemTimes && pGetSystemTimes(&idleTime, &kernelTime, &userTime)) + { + unsigned __int64 const idleTicks = + fileTimeToUInt64(idleTime); + unsigned __int64 const totalTicks = + fileTimeToUInt64(kernelTime) + fileTimeToUInt64(userTime); + return calculateCPULoad(idleTicks, totalTicks) * GetNumberOfPhysicalCPU(); + } + return -0.0; +#else + // Not implemented on this platform. + return -0.0; +#endif +} + /** Get the process id of the running process. */ diff --git a/Source/kwsys/SystemInformation.hxx.in b/Source/kwsys/SystemInformation.hxx.in index a9fd05d..4acdc4f 100644 --- a/Source/kwsys/SystemInformation.hxx.in +++ b/Source/kwsys/SystemInformation.hxx.in @@ -130,6 +130,10 @@ public: // Get system RAM used by this process id in units of KiB. LongLong GetProcMemoryUsed(); + // Return the load average of the machine or -0.0 if it cannot + // be determined. + double GetLoadAverage(); + // enable/disable stack trace signal handler. In order to // produce an informative stack trace the application should // be dynamically linked and compiled with debug symbols. diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index c834e34..fed1c9c 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -4408,7 +4408,7 @@ bool SystemTools::FileIsFullPath(const char* in_name, size_t len) bool SystemTools::GetShortPath(const kwsys_stl::string& path, kwsys_stl::string& shortPath) { -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) const int size = int(path.size()) +1; // size of return char *tempPath = new char[size]; // create a buffer DWORD ret; diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx index 82620da..1596fe4 100644 --- a/Source/kwsys/kwsysPlatformTestsCXX.cxx +++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx @@ -452,6 +452,19 @@ int main() } #endif +#ifdef TEST_KWSYS_CXX_HAS_GETLOADAVG +// Match feature definitions from SystemInformation.cxx +#if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE) +# define _GNU_SOURCE +#endif +#include <stdlib.h> +int main() +{ + double loadavg[3] = { 0.0, 0.0, 0.0 }; + return getloadavg(loadavg, 3); +} +#endif + #ifdef TEST_KWSYS_CXX_HAS_RLIMIT64 # if defined(KWSYS_HAS_LFS) # define _LARGEFILE_SOURCE diff --git a/Source/kwsys/testSystemInformation.cxx b/Source/kwsys/testSystemInformation.cxx index 53d51ac..fc8ea55 100644 --- a/Source/kwsys/testSystemInformation.cxx +++ b/Source/kwsys/testSystemInformation.cxx @@ -87,6 +87,7 @@ int testSystemInformation(int, char*[]) printMethod3(info, GetProcMemoryAvailable("KWSHL","KWSPL"), "KiB"); printMethod3(info, GetHostMemoryUsed(), "KiB"); printMethod3(info, GetProcMemoryUsed(), "KiB"); + printMethod(info, GetLoadAverage); for (long int i = 0; i <= 31; i++) { diff --git a/Tests/CTestUpdateCVS.cmake.in b/Tests/CTestUpdateCVS.cmake.in index 1699c3f..277b3a6 100644 --- a/Tests/CTestUpdateCVS.cmake.in +++ b/Tests/CTestUpdateCVS.cmake.in @@ -170,3 +170,22 @@ set(CTEST_CHECKOUT_COMMAND # Run the dashboard script with CTest. run_dashboard_script(dash-binary) + +#----------------------------------------------------------------------------- +# Test ctest_update(RETURN_VALUE) on failure +message("Running CTest Dashboard Script (fail to update)...") + +set(ctest_update_check [[ +if(NOT ret LESS 0) + message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}") +endif() +]]) +create_dashboard_script(dash-binary-fail + "set(CTEST_CVS_COMMAND \"update-command-does-not-exist\") +") +unset(ctest_update_check) + +# Run the dashboard script with CTest. +set(FAIL_UPDATE 1) +run_dashboard_script(dash-binary-fail) +unset(FAIL_UPDATE) diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 77b3398..458e427 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -182,6 +182,14 @@ endfunction() #----------------------------------------------------------------------------- # Function to write the dashboard test script. function(create_dashboard_script bin_dir custom_text) + if (NOT ctest_update_check) + set(ctest_update_check [[ +if(ret LESS 0) + message(FATAL_ERROR "ctest_update failed with ${ret}") +endif() +]]) + endif() + # Write the dashboard script. file(WRITE ${TOP}/${bin_dir}.cmake "# CTest Dashboard Script @@ -193,8 +201,8 @@ set(CTEST_BINARY_DIRECTORY \${CTEST_DASHBOARD_ROOT}/${bin_dir}) ${custom_text} # Start a dashboard and run the update step ctest_start(Experimental) -ctest_update(SOURCE \${CTEST_SOURCE_DIRECTORY}) -") +ctest_update(SOURCE \${CTEST_SOURCE_DIRECTORY} RETURN_VALUE ret ${ctest_update_args}) +${ctest_update_check}") endfunction() #----------------------------------------------------------------------------- @@ -250,6 +258,24 @@ function(check_no_update bin_dir) endif() endfunction() +#----------------------------------------------------------------------------- +# Function to find the Update.xml file and make sure +# it only has the UpdateReturnStatus failure message and no updates. +function(check_fail_update bin_dir) + set(PATTERN ${TOP}/${bin_dir}/Testing/*/Update.xml) + file(GLOB UPDATE_XML_FILE RELATIVE ${TOP} ${PATTERN}) + string(REGEX REPLACE "//Update.xml$" "/Update.xml" + UPDATE_XML_FILE "${UPDATE_XML_FILE}") + message(" found ${UPDATE_XML_FILE}") + file(STRINGS ${TOP}/${UPDATE_XML_FILE} UPDATE_XML_STATUS + REGEX "^\t<UpdateReturnStatus>[^<\n]+" + ) + if(UPDATE_XML_STATUS MATCHES "Update command failed") + message(" correctly found 'Update command failed'") + else() + message(FATAL_ERROR " missing 'Update command failed'") + endif() +endfunction() #----------------------------------------------------------------------------- # Function to run the dashboard through a script @@ -263,6 +289,8 @@ function(run_dashboard_script bin_dir) list(APPEND UPDATE_MAYBE Updated{subdir} Updated{CTestConfig.cmake}) if(NO_UPDATE) check_no_update(${bin_dir}) + elseif(FAIL_UPDATE) + check_fail_update(${bin_dir}) else() check_updates(${bin_dir} Updated{foo.txt} diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index 5987a30..6488a1f 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -334,31 +334,22 @@ set(CTEST_UPDATE_VERSION_ONLY TRUE) # Run the dashboard script with CTest. set(NO_UPDATE 1) run_dashboard_script(dash-binary-no-update) +unset(NO_UPDATE) rewind_source(dash-source) #----------------------------------------------------------------------------- # Test ctest_update(QUIET) -set(NO_UPDATE 0) message("Running CTest Dashboard Script (update quietly)...") +set(ctest_update_args QUIET) create_dashboard_script(dash-binary-quiet "# git command configuration set(CTEST_GIT_COMMAND \"${GIT}\") set(CTEST_GIT_UPDATE_OPTIONS) set(CTEST_GIT_UPDATE_CUSTOM \${CTEST_GIT_COMMAND} pull origin master) ") - -# We need to modify the created dashboard script to include our "QUIET" -# option. -set(filename "${TOP}/dash-binary-quiet.cmake") -file(READ "${filename}" contents) -string(REPLACE - [=[ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY})]=] - [=[ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY} QUIET)]=] - contents - "${contents}") -file(WRITE "${filename}" "${contents}") +unset(ctest_update_args) # Run the dashboard script with CTest. run_dashboard_script(dash-binary-quiet) @@ -367,3 +358,23 @@ run_dashboard_script(dash-binary-quiet) if("${OUTPUT}" MATCHES "Updating the repository") message(FATAL_ERROR "Found 'Updating the repository' in quiet output") endif() + +#----------------------------------------------------------------------------- +# Test ctest_update(RETURN_VALUE) on failure +message("Running CTest Dashboard Script (fail to update)...") + +set(ctest_update_check [[ + +if(NOT ret LESS 0) + message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}") +endif() +]]) +create_dashboard_script(dash-binary-fail + "set(CTEST_GIT_COMMAND \"update-command-does-not-exist\") +") +unset(ctest_update_check) + +# Run the dashboard script with CTest. +set(FAIL_UPDATE 1) +run_dashboard_script(dash-binary-fail) +unset(FAIL_UPDATE) diff --git a/Tests/CTestUpdateHG.cmake.in b/Tests/CTestUpdateHG.cmake.in index c5440f9..c76bf91 100644 --- a/Tests/CTestUpdateHG.cmake.in +++ b/Tests/CTestUpdateHG.cmake.in @@ -164,3 +164,22 @@ execute_process( # Run the dashboard script with CTest. run_dashboard_script(dash-binary) + +#----------------------------------------------------------------------------- +# Test ctest_update(RETURN_VALUE) on failure +message("Running CTest Dashboard Script (fail to update)...") + +set(ctest_update_check [[ +if(NOT ret LESS 0) + message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}") +endif() +]]) +create_dashboard_script(dash-binary-fail + "set(CTEST_HG_COMMAND \"update-command-does-not-exist\") +") +unset(ctest_update_check) + +# Run the dashboard script with CTest. +set(FAIL_UPDATE 1) +run_dashboard_script(dash-binary-fail) +unset(FAIL_UPDATE) diff --git a/Tests/CTestUpdateSVN.cmake.in b/Tests/CTestUpdateSVN.cmake.in index b5728fd..b757a44 100644 --- a/Tests/CTestUpdateSVN.cmake.in +++ b/Tests/CTestUpdateSVN.cmake.in @@ -147,3 +147,22 @@ set(CTEST_CHECKOUT_COMMAND # Run the dashboard script with CTest. run_dashboard_script(dash-binary) + +#----------------------------------------------------------------------------- +# Test ctest_update(RETURN_VALUE) on failure +message("Running CTest Dashboard Script (fail to update)...") + +set(ctest_update_check [[ +if(NOT ret LESS 0) + message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}") +endif() +]]) +create_dashboard_script(dash-binary-fail + "set(CTEST_SVN_COMMAND \"update-command-does-not-exist\") +") +unset(ctest_update_check) + +# Run the dashboard script with CTest. +set(FAIL_UPDATE 1) +run_dashboard_script(dash-binary-fail) +unset(FAIL_UPDATE) diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt index 00a5375..fd55c42 100644 --- a/Tests/ExportImport/Export/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt @@ -39,7 +39,11 @@ install(FILES DESTINATION src ) +add_library(cmakeonly INTERFACE) +set_property(TARGET cmakeonly PROPERTY INTERFACE_COMPILE_DEFINITIONS [[DEF="\"\$\B"]]) + install(TARGETS headeronly sharediface use_auto_type use_c_restrict source_target + cmakeonly EXPORT expInterface ) install(TARGETS sharedlib diff --git a/Tests/ExportImport/Import/Interface/CMakeLists.txt b/Tests/ExportImport/Import/Interface/CMakeLists.txt index 51d518e..c850508 100644 --- a/Tests/ExportImport/Import/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Import/Interface/CMakeLists.txt @@ -99,3 +99,14 @@ add_executable(interfacetest_exp interfacetest.cpp) target_link_libraries(interfacetest_exp exp::sharediface) do_try_compile(exp) + +foreach(ns exp bld) + get_property(defs TARGET ${ns}::cmakeonly PROPERTY INTERFACE_COMPILE_DEFINITIONS) + if(NOT defs STREQUAL [[DEF="\"\$\B"]]) + message(SEND_ERROR + "${ns}::cmakeonly property INTERFACE_COMPILE_DEFINITIONS is:\n" + " ${defs}\n" + "not\n" + " " [[DEF="\"\$\B"]] "\n") + endif() +endforeach() diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index de62ce7..b5041c7 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -364,6 +364,66 @@ if(do_git_tests) ) set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + # Unzip/untar the git repository in our source folder so that other + # projects below may use it to test git args of ExternalProject_Add + # + set(proj SetupLocalGITRepositoryWithSubmodules) + ExternalProject_Add(${proj} + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/LocalRepositories/GIT-with-submodules + URL ${CMAKE_CURRENT_SOURCE_DIR}/gitrepo-sub.tgz + BUILD_COMMAND "" + CONFIGURE_COMMAND "${GIT_EXECUTABLE}" --version + INSTALL_COMMAND "" + ) + set_property(TARGET ${proj} + PROPERTY FOLDER "SetupRepos/Local/Deeply/Nested/For/Testing") + + set(local_git_repo "../../LocalRepositories/GIT-with-submodules") + + set(proj TS1-GIT-no-GIT_SUBMODULES) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + -DWITH_m1:BOOL=ON + -DWITH_m2:BOOL=ON + BUILD_COMMAND "" + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + "SetupLocalGITRepositoryWithSubmodules" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + + set(proj TS1-GIT-empty-GIT_SUBMODULES) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + GIT_SUBMODULES "" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + -DWITH_m1:BOOL=ON + -DWITH_m2:BOOL=ON + BUILD_COMMAND "" + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + "SetupLocalGITRepositoryWithSubmodules" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + + set(proj TS1-GIT-some-GIT_SUBMODULES) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + GIT_SUBMODULES "m/m1" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + -DWITH_m1:BOOL=ON + -DWITH_m2:BOOL=OFF + BUILD_COMMAND "" + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + "SetupLocalGITRepositoryWithSubmodules" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + endif() set(do_hg_tests 0) diff --git a/Tests/ExternalProject/gitrepo-sub.tgz b/Tests/ExternalProject/gitrepo-sub.tgz Binary files differnew file mode 100644 index 0000000..c0b5360 --- /dev/null +++ b/Tests/ExternalProject/gitrepo-sub.tgz diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 60b44fd..ebcfc0f 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -34,8 +34,8 @@ else() include_directories(${Qt5Widgets_INCLUDE_DIRS}) set(QT_LIBRARIES Qt5::Widgets) - if(Qt5_POSITION_INDEPENDENT_CODE) - set(CMAKE_POSITION_INDEPENDENT_CODE ON) + if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC) + add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC}) endif() macro(qtx_wrap_cpp) @@ -167,3 +167,26 @@ file(TIMESTAMP "${qrc_file1}" file1_step1 "${timeformat}") if (NOT file1_step1 GREATER file1_before) message(SEND_ERROR "file1 (${qrc_file1}) should have changed in the first step!") endif() + +#----------------------------------------------------------------------------- +try_compile(MOC_RERUN + "${CMAKE_CURRENT_BINARY_DIR}/automoc_rerun" + "${CMAKE_CURRENT_SOURCE_DIR}/automoc_rerun" + automoc_rerun + CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}" + OUTPUT_VARIABLE output +) +if (NOT MOC_RERUN) + message(SEND_ERROR "Initial build of automoc_rerun failed. Output: ${output}") +endif() + +configure_file(automoc_rerun/test1.h.in2 automoc_rerun/test1.h COPYONLY) + +execute_process(COMMAND "${CMAKE_COMMAND}" --build . + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/automoc_rerun" + RESULT_VARIABLE automoc_rerun_result + ) +if (automoc_rerun_result) + message(SEND_ERROR "Second build of automoc_rerun failed.") +endif() diff --git a/Tests/QtAutogen/automoc_rerun/CMakeLists.txt b/Tests/QtAutogen/automoc_rerun/CMakeLists.txt new file mode 100644 index 0000000..17bc332 --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.1) +project(automoc_rerun CXX) + +if (QT_TEST_VERSION STREQUAL 4) + find_package(Qt4 REQUIRED) + set(QT_CORE_TARGET Qt4::QtCore) +else() + if (NOT QT_TEST_VERSION STREQUAL 5) + message(SEND_ERROR "Invalid Qt version specified.") + endif() + + find_package(Qt5Core REQUIRED) + set(QT_CORE_TARGET Qt5::Core) +endif() + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +configure_file(test1.h.in1 test1.h COPYONLY) + +add_executable(test1 + ${CMAKE_CURRENT_BINARY_DIR}/test1.h + test1.cpp + res1.qrc + ) +target_include_directories(test1 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries(test1 ${QT_CORE_TARGET}) diff --git a/Tests/QtAutogen/automoc_rerun/input.txt b/Tests/QtAutogen/automoc_rerun/input.txt new file mode 100644 index 0000000..da62762 --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/input.txt @@ -0,0 +1 @@ +Res1 input. diff --git a/Tests/QtAutogen/automoc_rerun/res1.qrc b/Tests/QtAutogen/automoc_rerun/res1.qrc new file mode 100644 index 0000000..fb804b5 --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/res1.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>input.txt</file> + </qresource> +</RCC> diff --git a/Tests/QtAutogen/automoc_rerun/test1.cpp b/Tests/QtAutogen/automoc_rerun/test1.cpp new file mode 100644 index 0000000..4316a91 --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/test1.cpp @@ -0,0 +1,5 @@ +#include "test1.h" +int main() +{ + return 0; +} diff --git a/Tests/QtAutogen/automoc_rerun/test1.h.in1 b/Tests/QtAutogen/automoc_rerun/test1.h.in1 new file mode 100644 index 0000000..fee2c09 --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/test1.h.in1 @@ -0,0 +1,8 @@ +#include <QObject> +class test1 : public QObject +{ + Q_OBJECT + public slots: + void onTst1() {} + void onTst2() {} +}; diff --git a/Tests/QtAutogen/automoc_rerun/test1.h.in2 b/Tests/QtAutogen/automoc_rerun/test1.h.in2 new file mode 100644 index 0000000..6531d10 --- /dev/null +++ b/Tests/QtAutogen/automoc_rerun/test1.h.in2 @@ -0,0 +1,7 @@ +#include <QObject> +class test1 : public QObject +{ + Q_OBJECT + public slots: + void onTst1() {} +}; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 592b5e4..bc706d3 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -26,6 +26,39 @@ macro(add_RunCMake_test test) ) endmacro() +function(add_RunCMake_test_group test types) + # create directory for common content + set(TEST_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/${test}/conf") + file(REMOVE_RECURSE "${TEST_CONFIG_DIR}") + file(MAKE_DIRECTORY "${TEST_CONFIG_DIR}") + + foreach(type IN LISTS types) + # generate prerequirements config file in cmake as ctest doesn't have as + # much system information so it is easier to set programs and environment + # values here + unset(${test}_${type}_FOUND_PREREQUIREMENTS) + include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake") + get_test_prerequirements("${test}_${type}_FOUND_PREREQUIREMENTS" + "${TEST_CONFIG_DIR}/${type}_config.cmake") + + # only add the test if prerequirements are met + if(${test}_${type}_FOUND_PREREQUIREMENTS) + add_test(NAME RunCMake.${test}_${type} COMMAND ${CMAKE_CMAKE_COMMAND} + -DTEST_TYPE=${type} + -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} + -DRunCMake_GENERATOR=${CMAKE_GENERATOR} + -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} + -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} + -DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} + -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} + -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${type}/${test} + -Dconfig_file=${TEST_CONFIG_DIR}/${type}_config.cmake + -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" + ) + endif() + endforeach() +endfunction() + if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3) set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1) endif() @@ -95,6 +128,7 @@ add_RunCMake_test(FPHSA) add_RunCMake_test(GeneratorExpression) add_RunCMake_test(GeneratorPlatform) add_RunCMake_test(GeneratorToolset) +add_RunCMake_test(GNUInstallDirs) add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(ObjectLibrary) @@ -206,10 +240,6 @@ add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths) set(IfacePaths_SOURCES_ARGS -DTEST_PROP=SOURCES) add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths) -if(RPMBUILD_EXECUTABLE) - add_RunCMake_test(CPackRPM) -endif() - add_RunCMake_test(COMPILE_LANGUAGE-genex) # Matlab module related tests @@ -232,4 +262,7 @@ endif() if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_executable(pseudo_iwyu pseudo_iwyu.c) add_RunCMake_test(IncludeWhatYouUse -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>) + add_RunCMake_test(CompilerLauncher) endif() + +add_RunCMake_test_group(CPack "DEB;RPM") diff --git a/Tests/RunCMake/CPack/CMakeLists.txt b/Tests/RunCMake/CPack/CMakeLists.txt new file mode 100644 index 0000000..7905706 --- /dev/null +++ b/Tests/RunCMake/CPack/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.1 FATAL_ERROR) + +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) + +# include test generator specifics +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${GENERATOR_TYPE}/${RunCMake_TEST}-specifics.cmake") + include("${GENERATOR_TYPE}/${RunCMake_TEST}-specifics.cmake") +endif() + +set(CPACK_GENERATOR "${GENERATOR_TYPE}") +include(CPack) diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake new file mode 100644 index 0000000..7ea2a24 --- /dev/null +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -0,0 +1,76 @@ +cmake_policy(SET CMP0057 NEW) + +function(run_cpack_test TEST_NAME types build) + if(TEST_TYPE IN_LIST types) + set(RunCMake_TEST_NO_CLEAN TRUE) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build") + + # TODO this should be executed only once per ctest run (not per generator) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + # execute cmake + execute_process( + COMMAND "${CMAKE_COMMAND}" -DRunCMake_TEST=${TEST_NAME} + -DGENERATOR_TYPE=${TEST_TYPE} "${RunCMake_SOURCE_DIR}" + WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" + RESULT_VARIABLE res + OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" + ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt" + ) + + if(res) + run_cmake_command( + ${TEST_TYPE}/${TEST_NAME} + "${CMAKE_COMMAND}" + -DRunCMake_TEST_STEP=configure + -Dreturn_code=${res} + "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" + -P "${RunCMake_SOURCE_DIR}/PreTestError.cmake" + ) + return() + endif() + + # execute optional build step + if(build) + execute_process( + COMMAND "${CMAKE_COMMAND}" --build "${RunCMake_TEST_BINARY_DIR}" + RESULT_VARIABLE res + OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" + ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt" + ) + endif() + + if(res) + run_cmake_command( + ${TEST_TYPE}/${TEST_NAME} + "${CMAKE_COMMAND}" + -DRunCMake_TEST_STEP=build + -Dreturn_code=${res} + "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" + -P "${RunCMake_SOURCE_DIR}/PreTestError.cmake" + ) + return() + endif() + + # execute cpack + execute_process( + COMMAND "${CMAKE_CPACK_COMMAND}" + WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" + OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" + ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt" + ) + + # verify result + run_cmake_command( + ${TEST_TYPE}/${TEST_NAME} + "${CMAKE_COMMAND}" + -DRunCMake_TEST=${TEST_NAME} + -DGENERATOR_TYPE=${TEST_TYPE} + "-Dsrc_dir=${RunCMake_SOURCE_DIR}" + "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" + "-Dconfig_file=${config_file}" + -P "${RunCMake_SOURCE_DIR}/VerifyResult.cmake" + ) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake new file mode 100644 index 0000000..4ed3fbd --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -0,0 +1,10 @@ +set(ALL_FILES_GLOB "*.deb") + +function(getPackageContent FILE RESULT_VAR) + execute_process(COMMAND ${DPKG_EXECUTABLE} -c ${FILE} + OUTPUT_VARIABLE package_content_ + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake new file mode 100644 index 0000000..9e4aa7c --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "minimal*.deb") +set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/foo/${whitespaces_}.*/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake b/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake new file mode 100644 index 0000000..8821ab9 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake @@ -0,0 +1 @@ +set(CPACK_PACKAGE_CONTACT "someone") diff --git a/Tests/RunCMake/CPack/DEB/Prerequirements.cmake b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake new file mode 100644 index 0000000..197b99d --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake @@ -0,0 +1,8 @@ +function(get_test_prerequirements found_var config_file) + find_program(DPKG_EXECUTABLE dpkg) + + if(DPKG_EXECUTABLE) + file(WRITE "${config_file}" "set(DPKG_EXECUTABLE \"${DPKG_EXECUTABLE}\")") + set(${found_var} true PARENT_SCOPE) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/MINIMAL.cmake b/Tests/RunCMake/CPack/MINIMAL.cmake new file mode 100644 index 0000000..f29ad2a --- /dev/null +++ b/Tests/RunCMake/CPack/MINIMAL.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) + +set(CPACK_PACKAGE_NAME "minimal") diff --git a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake b/Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake index 31e729b..31e729b 100644 --- a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake +++ b/Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake diff --git a/Tests/RunCMake/CPack/PreTestError.cmake b/Tests/RunCMake/CPack/PreTestError.cmake new file mode 100644 index 0000000..f88f2e8 --- /dev/null +++ b/Tests/RunCMake/CPack/PreTestError.cmake @@ -0,0 +1,7 @@ +file(READ "${bin_dir}/test_output.txt" output) +file(READ "${bin_dir}/test_error.txt" error) + +message(FATAL_ERROR "Error in pre-test phase '${RunCMake_TEST_STEP}'!\n" + "Return code: '${return_code}'\n" + "Info output: '${output}'\n" + "Error output: '${error}'") diff --git a/Tests/RunCMake/CPack/README.txt b/Tests/RunCMake/CPack/README.txt new file mode 100644 index 0000000..365c737 --- /dev/null +++ b/Tests/RunCMake/CPack/README.txt @@ -0,0 +1,99 @@ +RunCMake.CPack is a test module that is intended for testing of package +generators that can be validated from command line. + +------------- +Adding a test +------------- + +CPack test root directory: 'Tests/RunCMake/CPack'. + +All phases are executed separately for each generator that is bound to a test. +Tests for each generator are subtests of test 'RunCMake.CPack_<generator_name>'. + +Each test must also be added to 'RunCMakeTest.cmake' script located in CPack +test root directory. +Line that adds a test is: +run_cpack_test(<test_name> "<generator_name>") + +<generator_name> may be one generator e.g. "RPM" or multiple e.g. "RPM;DEB" and +will be run for all listed generators. + +Test consists of +- CMake execution phase +- CPack execution phase +- verification of generated files + +CMake execution phase: +---------------------- + +To add a new CPack test we first create a <test_name>.cmake script that contains +CMake commands that should be used as a preparation script for generation of +different types of packages. This script is placed into CPack test root +directory even if it will be used for only one of the generators. + +If test will be used for multiple generators but some of them require some +generator speciffic commands then those commands should be added to a separate +file that should be located in '<generator_name>/<test_name>-specifics.cmake' +in CPack test root directory. + +CPack execution phase: +---------------------- + +Only exececutes CPack for content that was generated during CMake execution +phase. + +Verification of generated files: +-------------------------------- + +Verification of generated files consists of two phases +- mandatory verification phase +- optional verification phase + +Mandatory verification phase checks that expected files were generated and +contain expected files. +Mandatory verification phase also checks that no other unexpected package files +were generated (this is executed even if EXPECTED_FILES_COUNT contains 0 in +order to verify that no files were generated). +CMake script '<generator_name>/<test_name>-ExpectedFiles.cmake' is required by +this step and must contain +- EXPECTED_FILES_COUNT variable that contains the number of expected files that + will be generated (0 or more) +- EXPECTED_FILE_<file_number_starting_with_1> that contains globing expression + that uniquely defines expected file name (will be used to find expected file) + and should be present once for each expected file +- EXPECTED_FILE_CONTENT_<file_number_starting_with_1> that contains regular + expression of files that should be present in generated file and should be + present once for each expected file + +Optional verification phase is generator specific and is optionaly executed. +This phase is executed if '<generator_name>/<test_name>-VerifyResult.cmake' +script exists. +In case that the script doesn't exist VerifyResult.cmake script automatically +prints out standard output and standard error from CPack execution phase that +is compared with '<generator_name>/<test_name>-stdout.txt' regular expression +and '<generator_name>/<test_name>-stderr.txt' regular expresson respectively. + +---------------------- +Adding a new generator +---------------------- + +To add a new generator we must +- add new generator directory (e.g. RPM for RPM generator) to CPack test root + directory that contains 'Helpers.cmake' script. In this script a function + named 'getPackageContent' must exist. This function should list files that + are contained in a package. Function should accept two parameters + + FILE variable that will contain path to file for which the content should be + listed + + RESULT_VAR that will tell the function which variable in parent scope should + contain the result (list of files inside package file) +- add 'Prerequirements.cmake' script to generator directory. In this script a + function named 'get_test_prerequirements' must exist. This function should + set a variable in parent scope (name of the variable is the first parameter) + that tells if prerequirements for test execution are met (certain programs, + OS specifics, ...) and create a config file (name of the variable which + contains file name and path is provided with the second parameter) that + should contain 'set' commands for variables that will later be used in tests + (e.g. location of dpkg program for DEB packages) +- add tests the same way as described above +- add generator to 'add_RunCMake_test_group' function call that is located in + RunCMake CMakeLists.txt file diff --git a/Tests/RunCMake/CPack/RPM/Helpers.cmake b/Tests/RunCMake/CPack/RPM/Helpers.cmake new file mode 100644 index 0000000..98cdad8 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake @@ -0,0 +1,10 @@ +set(ALL_FILES_GLOB "*.rpm") + +function(getPackageContent FILE RESULT_VAR) + execute_process(COMMAND ${RPM_EXECUTABLE} -pql ${FILE} + OUTPUT_VARIABLE package_content_ + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake new file mode 100644 index 0000000..800b78e --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "minimal*.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt b/Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt new file mode 100644 index 0000000..7c5fb46 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt @@ -0,0 +1 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MINIMAL-build/_CPack_Packages/.*/RPM/SPECS/minimal.spec$ diff --git a/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake new file mode 100644 index 0000000..4e01f7b --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake @@ -0,0 +1,5 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_1 "PARTIALLY_RELOCATABLE_WARNING-0.1.1-*.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/not_relocatable${whitespaces_}/not_relocatable/CMakeLists.txt${whitespaces_}/opt$") diff --git a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt b/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-stderr.txt index 3b63d5b..3b63d5b 100644 --- a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt +++ b/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-stderr.txt diff --git a/Tests/RunCMake/CPack/RPM/Prerequirements.cmake b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake new file mode 100644 index 0000000..3416205 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake @@ -0,0 +1,16 @@ +function(get_test_prerequirements found_var config_file) + if(CMAKE_CURRENT_BINARY_DIR MATCHES " ") + # rpmbuild can't handle spaces in path + return() + endif() + + find_program(RPM_EXECUTABLE rpm) + find_program(RPMBUILD_EXECUTABLE rpmbuild) + + if(RPM_EXECUTABLE AND RPMBUILD_EXECUTABLE) + file(WRITE "${config_file}" "set(RPM_EXECUTABLE \"${RPM_EXECUTABLE}\")") + file(APPEND "${config_file}" + "\nset(RPMBUILD_EXECUTABLE \"${RPMBUILD_EXECUTABLE}\")") + set(${found_var} true PARENT_SCOPE) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake new file mode 100644 index 0000000..308b8cc --- /dev/null +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1 FATAL_ERROR) + +include(RunCMake) +include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") + +# args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP +run_cpack_test(MINIMAL "RPM;DEB" false) +run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false) diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake new file mode 100644 index 0000000..809011b --- /dev/null +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -0,0 +1,91 @@ +cmake_minimum_required(VERSION 3.1 FATAL_ERROR) + +include("${config_file}") +include("${src_dir}/${GENERATOR_TYPE}/Helpers.cmake") + +file(READ "${bin_dir}/test_output.txt" output) +file(READ "${bin_dir}/test_error.txt" error) +file(READ "${config_file}" config_file_content) + +set(output_error_message + "\nCPack output: '${output}'\nCPack error: '${error}';\nconfig file: '${config_file_content}'") + +# check that expected generated files exist and contain expected content +include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-ExpectedFiles.cmake") + +if(NOT EXPECTED_FILES_COUNT EQUAL 0) + foreach(file_no_ RANGE 1 ${EXPECTED_FILES_COUNT}) + file(GLOB foundFile_ RELATIVE "${bin_dir}" "${EXPECTED_FILE_${file_no_}}") + set(foundFiles_ "${foundFiles_};${foundFile_}") + list(LENGTH foundFile_ foundFilesCount_) + + if(foundFilesCount_ EQUAL 1) + unset(PACKAGE_CONTENT) + getPackageContent("${bin_dir}/${foundFile_}" "PACKAGE_CONTENT") + + string(REGEX MATCH "${EXPECTED_FILE_CONTENT_${file_no_}}" + expected_content_list "${PACKAGE_CONTENT}") + + if(NOT expected_content_list) + message(FATAL_ERROR + "Unexpected file content for file No. '${file_no_}'!" + " Content: '${PACKAGE_CONTENT}'" + "${output_error_message}") + endif() + else() + message(FATAL_ERROR + "Found more than one file for file No. '${file_no_}'!" + " Found files count '${foundFilesCount_}'." + " Files: '${foundFile_}'" + "${output_error_message}") + endif() + endforeach() + + # check that there were no extra files generated + foreach(all_files_glob_ IN LISTS ALL_FILES_GLOB) + file(GLOB foundAll_ RELATIVE "${bin_dir}" "${all_files_glob_}") + set(allFoundFiles_ "${allFoundFiles_};${foundAll_}") + endforeach() + + list(LENGTH foundFiles_ foundFilesCount_) + list(LENGTH allFoundFiles_ allFoundFilesCount_) + + if(NOT foundFilesCount_ EQUAL allFoundFilesCount_) + message(FATAL_ERROR + "Found more files than expected! Found files: '${allFoundFiles_}'" + "${output_error_message}") + endif() + + # sanity check that we didn't accidentaly list wrong files with our regular + # expressions + foreach(expected_ IN LISTS allFoundFiles_) + list(FIND foundFiles_ "${expected_}" found_) + + if(found_ EQUAL -1) + message(FATAL_ERROR + "Expected files don't match found files! Found files:" + " '${allFoundFiles_}'" + "${output_error_message}") + endif() + endforeach() +else() + # there should be no generated files present + foreach(missing_file_glob_ IN LISTS ALL_FILES_GLOB) + file(GLOB checkMissingFiles_ RELATIVE "${bin_dir}" "${missing_file_glob_}") + + if(checkMissingFiles_) + message(FATAL_ERROR "Unexpected files found: '${checkMissingFiles_}'" + "${output_error_message}") + endif() + endforeach() +endif() + +# handle additional result verifications +if(EXISTS "${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-VerifyResult.cmake") + include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-VerifyResult.cmake") +else() + # by default only print out output and error so that they can be compared by + # regex + message(STATUS "${output}") + message("${error}") +endif() diff --git a/Tests/RunCMake/CPackRPM/CMakeLists.txt b/Tests/RunCMake/CPackRPM/CMakeLists.txt deleted file mode 100644 index b7d170b..0000000 --- a/Tests/RunCMake/CPackRPM/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1 FATAL_ERROR) - -project(${RunCMake_TEST} NONE) -include(${RunCMake_TEST}.cmake) - -set(CPACK_GENERATOR "RPM") -include(CPack) diff --git a/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake b/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake deleted file mode 100644 index 1935e32..0000000 --- a/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake +++ /dev/null @@ -1,17 +0,0 @@ -include(RunCMake) - -function(run_cpack_rpm_test TEST_NAME) - set(RunCMake_TEST_NO_CLEAN TRUE) - set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build") - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - execute_process( - COMMAND "${CMAKE_COMMAND}" -D RunCMake_TEST=${TEST_NAME} "${RunCMake_SOURCE_DIR}" - WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" - OUTPUT_QUIET - ERROR_QUIET - ) - run_cmake_command(${TEST_NAME} ${CMAKE_CPACK_COMMAND}) -endfunction() - -run_cpack_rpm_test(CPackRPM_PARTIALLY_RELOCATABLE_WARNING) diff --git a/Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt b/Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt new file mode 100644 index 0000000..af7cdc5 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt @@ -0,0 +1,13 @@ +Test timeout computed to be: [^ +]+ +1: -- Output on stdout +1: Output on stderr +1: -- Output on stdout +1: Output on stderr +1: -- Output on stdout +1: Output on stderr +1: -- Output on stdout +1: Output on stderr +1: -- Output on stdout +1: Output on stderr +1/1 Test #1: MergeOutput diff --git a/Tests/RunCMake/CTestCommandLine/MergeOutput.cmake b/Tests/RunCMake/CTestCommandLine/MergeOutput.cmake new file mode 100644 index 0000000..528ac90 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/MergeOutput.cmake @@ -0,0 +1,4 @@ +foreach(i RANGE 1 5) + message(STATUS "Output on stdout") + message("Output on stderr") +endforeach() diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 0cb11ac..a3ce139 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -39,3 +39,16 @@ subdirs() run_cmake_command(BadCTestTestfile ${CMAKE_CTEST_COMMAND}) endfunction() run_BadCTestTestfile() + +function(run_MergeOutput) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MergeOutput) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " +add_test(MergeOutput \"${CMAKE_COMMAND}\" -P \"${RunCMake_SOURCE_DIR}/MergeOutput.cmake\") +") + + run_cmake_command(MergeOutput ${CMAKE_CTEST_COMMAND} -V) +endfunction() +run_MergeOutput() diff --git a/Tests/RunCMake/CommandLine/BuildDir.cmake b/Tests/RunCMake/CommandLine/BuildDir.cmake new file mode 100644 index 0000000..30030a7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir.cmake @@ -0,0 +1 @@ +add_subdirectory(BuildDir) diff --git a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt new file mode 100644 index 0000000..20df108 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt @@ -0,0 +1,5 @@ +add_custom_command( + OUTPUT output.txt + COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt + ) +add_custom_target(CustomTarget ALL DEPENDS output.txt) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 69beed9..84d4cc9 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -22,13 +22,30 @@ run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -G NoSuchGenerator) run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P) run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake) +run_cmake_command(build-no-dir + ${CMAKE_COMMAND} --build) run_cmake_command(build-no-cache ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}) run_cmake_command(build-no-generator ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-no-generator) +run_cmake_command(build-bad-dir + ${CMAKE_COMMAND} --build dir-does-not-exist) run_cmake_command(build-bad-generator ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator) +function(run_BuildDir) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BuildDir-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(BuildDir) + run_cmake_command(BuildDir--build ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget) +endfunction() +run_BuildDir() + if(RunCMake_GENERATOR STREQUAL "Ninja") # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Build-build) diff --git a/Tests/RunCMake/CommandLine/build-bad-dir-result.txt b/Tests/RunCMake/CommandLine/build-bad-dir-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-bad-dir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/build-bad-dir-stderr.txt b/Tests/RunCMake/CommandLine/build-bad-dir-stderr.txt new file mode 100644 index 0000000..d3f3d9c --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-bad-dir-stderr.txt @@ -0,0 +1,2 @@ +^Error: [^ +]+/Tests/RunCMake/CommandLine/build-bad-dir-build/dir-does-not-exist is not a directory$ diff --git a/Tests/RunCMake/CommandLine/build-no-dir-result.txt b/Tests/RunCMake/CommandLine/build-no-dir-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-no-dir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/build-no-dir-stderr.txt b/Tests/RunCMake/CommandLine/build-no-dir-stderr.txt new file mode 100644 index 0000000..8d518f6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-no-dir-stderr.txt @@ -0,0 +1 @@ +^Usage: cmake --build <dir> \[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CompilerLauncher/C-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/C-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/C-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/C-launch-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/C-launch.cmake b/Tests/RunCMake/CompilerLauncher/C-launch.cmake new file mode 100644 index 0000000..e66ca20 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(C.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/C.cmake b/Tests/RunCMake/CompilerLauncher/C.cmake new file mode 100644 index 0000000..67bf7c4 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C.cmake @@ -0,0 +1,4 @@ +enable_language(C) +set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.c) diff --git a/Tests/RunCMake/CompilerLauncher/CMakeLists.txt b/Tests/RunCMake/CompilerLauncher/CMakeLists.txt new file mode 100644 index 0000000..18dfd26 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.2) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/CXX-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/CXX-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/CXX-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/CXX-launch-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/CXX-launch.cmake b/Tests/RunCMake/CompilerLauncher/CXX-launch.cmake new file mode 100644 index 0000000..3002c9d --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(CXX.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/CXX.cmake b/Tests/RunCMake/CompilerLauncher/CXX.cmake new file mode 100644 index 0000000..cdd3478 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX.cmake @@ -0,0 +1,4 @@ +enable_language(CXX) +set(CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.cxx) diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake new file mode 100644 index 0000000..5884d5c --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake @@ -0,0 +1,23 @@ +include(RunCMake) + +function(run_compiler_launcher lang) + # Use a single build tree for tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${lang}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${lang}) + + set(RunCMake_TEST_OUTPUT_MERGE 1) + if("${RunCMake_GENERATOR}" STREQUAL "Ninja") + set(verbose_args -- -v) + endif() + run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build . ${verbose_args}) +endfunction() + +run_compiler_launcher(C) +run_compiler_launcher(CXX) +if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") + run_compiler_launcher(C-launch) + run_compiler_launcher(CXX-launch) +endif() diff --git a/Tests/RunCMake/CompilerLauncher/main.c b/Tests/RunCMake/CompilerLauncher/main.c new file mode 100644 index 0000000..03b2213 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/Tests/RunCMake/CompilerLauncher/main.cxx b/Tests/RunCMake/CompilerLauncher/main.cxx new file mode 100644 index 0000000..76e8197 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/main.cxx @@ -0,0 +1 @@ +int main() { return 0; } diff --git a/Tests/RunCMake/GNUInstallDirs/CMakeLists.txt b/Tests/RunCMake/GNUInstallDirs/CMakeLists.txt new file mode 100644 index 0000000..74b3ff8 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GNUInstallDirs/Common.cmake b/Tests/RunCMake/GNUInstallDirs/Common.cmake new file mode 100644 index 0000000..eff2d54 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Common.cmake @@ -0,0 +1,28 @@ +set(CMAKE_SIZEOF_VOID_P 8) +set(CMAKE_LIBRARY_ARCHITECTURE "arch") +if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") + set(CMAKE_SYSTEM_NAME "OpenBSD-Fake") +endif() +include(GNUInstallDirs) +set(dirs + BINDIR + DATADIR + DATAROOTDIR + DOCDIR + INCLUDEDIR + INFODIR + LIBDIR + LIBEXECDIR + LOCALEDIR + LOCALSTATEDIR + MANDIR + SBINDIR + SHAREDSTATEDIR + SYSCONFDIR + ) +foreach(dir ${dirs}) + message("CMAKE_INSTALL_${dir}='${CMAKE_INSTALL_${dir}}'") +endforeach() +foreach(dir ${dirs}) + message("CMAKE_INSTALL_FULL_${dir}='${CMAKE_INSTALL_FULL_${dir}}'") +endforeach() diff --git a/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt new file mode 100644 index 0000000..aee8552 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt @@ -0,0 +1,28 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/Opt' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='share/info' +CMAKE_INSTALL_LIBDIR='(lib|lib64)' +CMAKE_INSTALL_LIBEXECDIR='libexec' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_MANDIR='share/man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/opt/Opt/bin' +CMAKE_INSTALL_FULL_DATADIR='/opt/Opt/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/opt/Opt/share' +CMAKE_INSTALL_FULL_DOCDIR='/opt/Opt/share/doc/Opt' +CMAKE_INSTALL_FULL_INCLUDEDIR='/opt/Opt/include' +CMAKE_INSTALL_FULL_INFODIR='/opt/Opt/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/opt/Opt/(lib|lib64)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/opt/Opt/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/opt/Opt/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var/opt/Opt' +CMAKE_INSTALL_FULL_MANDIR='/opt/Opt/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/opt/Opt/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/opt/Opt/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/etc/opt/Opt'$ diff --git a/Tests/RunCMake/GNUInstallDirs/Opt.cmake b/Tests/RunCMake/GNUInstallDirs/Opt.cmake new file mode 100644 index 0000000..49eab0e --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Opt.cmake @@ -0,0 +1,2 @@ +set(CMAKE_INSTALL_PREFIX "/opt/${PROJECT_NAME}") +include(Common.cmake) diff --git a/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt new file mode 100644 index 0000000..a95400e --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt @@ -0,0 +1,28 @@ +^CMAKE_INSTALL_BINDIR='usr/bin' +CMAKE_INSTALL_DATADIR='usr/share' +CMAKE_INSTALL_DATAROOTDIR='usr/share' +CMAKE_INSTALL_DOCDIR='usr/share/doc/Root' +CMAKE_INSTALL_INCLUDEDIR='usr/include' +CMAKE_INSTALL_INFODIR='usr/share/info' +CMAKE_INSTALL_LIBDIR='usr/(lib|lib64)' +CMAKE_INSTALL_LIBEXECDIR='usr/libexec' +CMAKE_INSTALL_LOCALEDIR='usr/share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_MANDIR='usr/share/man' +CMAKE_INSTALL_SBINDIR='usr/sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='usr/com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/usr/bin' +CMAKE_INSTALL_FULL_DATADIR='/usr/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share' +CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Root' +CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include' +CMAKE_INSTALL_FULL_INFODIR='/usr/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/usr/(lib|lib64)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' +CMAKE_INSTALL_FULL_MANDIR='/usr/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/Root.cmake b/Tests/RunCMake/GNUInstallDirs/Root.cmake new file mode 100644 index 0000000..f8cc641 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Root.cmake @@ -0,0 +1,2 @@ +set(CMAKE_INSTALL_PREFIX "/") +include(Common.cmake) diff --git a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake new file mode 100644 index 0000000..f88569a --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +run_cmake(Opt) +run_cmake(Root) +run_cmake(Usr) +run_cmake(UsrLocal) diff --git a/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt new file mode 100644 index 0000000..e10c4c5 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt @@ -0,0 +1,28 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/Usr' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='share/info' +CMAKE_INSTALL_LIBDIR='(lib|lib64|lib/arch)' +CMAKE_INSTALL_LIBEXECDIR='libexec' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_MANDIR='share/man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/usr/bin' +CMAKE_INSTALL_FULL_DATADIR='/usr/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share' +CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Usr' +CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include' +CMAKE_INSTALL_FULL_INFODIR='/usr/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/usr/(lib|lib64|lib/arch)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var' +CMAKE_INSTALL_FULL_MANDIR='/usr/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/Usr.cmake b/Tests/RunCMake/GNUInstallDirs/Usr.cmake new file mode 100644 index 0000000..62b7288 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/Usr.cmake @@ -0,0 +1,2 @@ +set(CMAKE_INSTALL_PREFIX "/usr") +include(Common.cmake) diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt b/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt new file mode 100644 index 0000000..8dcf25b --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt @@ -0,0 +1,28 @@ +^CMAKE_INSTALL_BINDIR='bin' +CMAKE_INSTALL_DATADIR='share' +CMAKE_INSTALL_DATAROOTDIR='share' +CMAKE_INSTALL_DOCDIR='share/doc/UsrLocal' +CMAKE_INSTALL_INCLUDEDIR='include' +CMAKE_INSTALL_INFODIR='share/info' +CMAKE_INSTALL_LIBDIR='(lib|lib64)' +CMAKE_INSTALL_LIBEXECDIR='libexec' +CMAKE_INSTALL_LOCALEDIR='share/locale' +CMAKE_INSTALL_LOCALSTATEDIR='var' +CMAKE_INSTALL_MANDIR='share/man' +CMAKE_INSTALL_SBINDIR='sbin' +CMAKE_INSTALL_SHAREDSTATEDIR='com' +CMAKE_INSTALL_SYSCONFDIR='etc' +CMAKE_INSTALL_FULL_BINDIR='/usr/local/bin' +CMAKE_INSTALL_FULL_DATADIR='/usr/local/share' +CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/local/share' +CMAKE_INSTALL_FULL_DOCDIR='/usr/local/share/doc/UsrLocal' +CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/local/include' +CMAKE_INSTALL_FULL_INFODIR='/usr/local/share/info' +CMAKE_INSTALL_FULL_LIBDIR='/usr/local/(lib|lib64)' +CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/local/libexec' +CMAKE_INSTALL_FULL_LOCALEDIR='/usr/local/share/locale' +CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/local/var' +CMAKE_INSTALL_FULL_MANDIR='/usr/local/share/man' +CMAKE_INSTALL_FULL_SBINDIR='/usr/local/sbin' +CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/local/com' +CMAKE_INSTALL_FULL_SYSCONFDIR='/usr/local/etc'$ diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal.cmake b/Tests/RunCMake/GNUInstallDirs/UsrLocal.cmake new file mode 100644 index 0000000..59d9331 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal.cmake @@ -0,0 +1,2 @@ +set(CMAKE_INSTALL_PREFIX "/usr/local") +include(Common.cmake) diff --git a/Tests/RunCMake/Syntax/FunctionUnmatched-result.txt b/Tests/RunCMake/Syntax/FunctionUnmatched-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/FunctionUnmatched-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/FunctionUnmatched-stderr.txt b/Tests/RunCMake/Syntax/FunctionUnmatched-stderr.txt new file mode 100644 index 0000000..776a8f2 --- /dev/null +++ b/Tests/RunCMake/Syntax/FunctionUnmatched-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at CMakeLists.txt:[0-9]+ \(include\): + A logical block opening on the line + + .*/Tests/RunCMake/Syntax/FunctionUnmatched.cmake:[0-9]+ \(function\) + + is not closed.$ diff --git a/Tests/RunCMake/Syntax/FunctionUnmatched.cmake b/Tests/RunCMake/Syntax/FunctionUnmatched.cmake new file mode 100644 index 0000000..515b6bf --- /dev/null +++ b/Tests/RunCMake/Syntax/FunctionUnmatched.cmake @@ -0,0 +1,2 @@ +function(f) +#endfunction() # missing diff --git a/Tests/RunCMake/Syntax/MacroUnmatched-result.txt b/Tests/RunCMake/Syntax/MacroUnmatched-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/MacroUnmatched-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/MacroUnmatched-stderr.txt b/Tests/RunCMake/Syntax/MacroUnmatched-stderr.txt new file mode 100644 index 0000000..1699c43 --- /dev/null +++ b/Tests/RunCMake/Syntax/MacroUnmatched-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at CMakeLists.txt:[0-9]+ \(include\): + A logical block opening on the line + + .*/Tests/RunCMake/Syntax/MacroUnmatched.cmake:[0-9]+ \(macro\) + + is not closed.$ diff --git a/Tests/RunCMake/Syntax/MacroUnmatched.cmake b/Tests/RunCMake/Syntax/MacroUnmatched.cmake new file mode 100644 index 0000000..302d96e --- /dev/null +++ b/Tests/RunCMake/Syntax/MacroUnmatched.cmake @@ -0,0 +1,2 @@ +macro(m) +#endmacro() # missing diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index c431280..fd012b9 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -110,5 +110,7 @@ run_cmake(CMP0053-NameWithEscapedSpacesQuoted) run_cmake(CMP0053-NameWithEscapedTabsQuoted) # Function and macro tests. +run_cmake(FunctionUnmatched) run_cmake(FunctionUnmatchedForeach) +run_cmake(MacroUnmatched) run_cmake(MacroUnmatchedForeach) diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index f97022e..533c6a1 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -6,3 +6,4 @@ run_cmake(CMP0023-WARN-2) run_cmake(CMP0023-NEW-2) run_cmake(MixedSignature) run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses) +run_cmake(SubDirTarget) diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt new file mode 100644 index 0000000..5cd1f23 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at SubDirTarget.cmake:[0-9]+ \(target_link_libraries\): + Attempt to add link library "m" to target "subexe" which is not built in + this directory. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake b/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake new file mode 100644 index 0000000..32431ce --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake @@ -0,0 +1,3 @@ +enable_language(C) +add_subdirectory(SubDirTarget) +target_link_libraries(subexe m) diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt new file mode 100644 index 0000000..b0b2380 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt @@ -0,0 +1 @@ +add_executable(subexe ../empty.c) diff --git a/Tests/RunCMake/target_link_libraries/empty.c b/Tests/RunCMake/target_link_libraries/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/empty.c diff --git a/Utilities/Doxygen/doc_makeall.sh.in b/Utilities/Doxygen/doc_makeall.sh.in index ed7b521..fceafdd 100755 --- a/Utilities/Doxygen/doc_makeall.sh.in +++ b/Utilities/Doxygen/doc_makeall.sh.in @@ -130,7 +130,7 @@ export RESULTING_HTML_TARZ_ARCHIVE_FILE="$DOXTEMP/$PROJECT_NAME-html.tar.gz" if test "x@VTK_SOURCE_DIR@" != "x" ; then if test "x$PERL_PROG" != "xNOTFOUND" ; then - $PERL_PROG "$PATH_TO_VTK_DOX_SCRIPTS/doc_contributors.pl" \ + "$PERL_PROG" "$PATH_TO_VTK_DOX_SCRIPTS/doc_contributors.pl" \ --authors "$SOURCE_DIR/Utilities/Doxygen/authors.txt" \ --cachedir "$DOXTEMP/cache" \ --class_group '^(cm[A-Z0-9][A-Za-z0-9]+)\.(?:c|cpp|cxx|h|fl)$' \ @@ -158,7 +158,7 @@ if test "x@VTK_SOURCE_DIR@" != "x" ; then fi if test "x$GNUPLOT_PROG" != "xNOTFOUND" ; then - $GNUPLOT_PROG "$DOXTEMP/contrib/history.plt" + "$GNUPLOT_PROG" "$DOXTEMP/contrib/history.plt" fi fi @@ -168,7 +168,7 @@ fi if test "x$DOXYGEN_PROG" != "xNOTFOUND" ; then if test "x$RM_PROG" != "xNOTFOUND" ; then - $RM_PROG -fr "$OUTPUT_DIRECTORY" + "$RM_PROG" -fr "$OUTPUT_DIRECTORY" fi "$DOXYGEN_PROG" "$DOXYFILE" @@ -182,7 +182,7 @@ fi if test "x@VTK_SOURCE_DIR@" != "x" ; then if test "x$PERL_PROG" != "xNOTFOUND" ; then - $PERL_PROG "$PATH_TO_VTK_DOX_SCRIPTS/doc_rmpath.pl" \ + "$PERL_PROG" "$PATH_TO_VTK_DOX_SCRIPTS/doc_rmpath.pl" \ --verbose \ --to "$INTERMEDIATE_DOX_DIR" \ --html "$OUTPUT_DIRECTORY/html" @@ -198,7 +198,7 @@ if test "x$COMPILE_HTML_HELP" == "xON" ; then if test "x$HHC_PROG" != "xNOTFOUND" ; then "$HHC_PROG" index.hhp if test "x$MV_PROG" != "xNOTFOUND" ; then - $MV_PROG -f index.chm "$RESULTING_HTML_HELP_FILE" + "$MV_PROG" -f index.chm "$RESULTING_HTML_HELP_FILE" fi fi fi @@ -212,15 +212,15 @@ if test "x$CREATE_HTML_TARZ_ARCHIVE" == "xON" ; then cd "$OUTPUT_DIRECTORY" if test "x$TAR_PROG" != "xNOTFOUND" ; then if test "x$RM_PROG" != "xNOTFOUND" ; then - $RM_PROG -f html.tar + "$RM_PROG" -f html.tar fi - $TAR_PROG -cf html.tar html + "$TAR_PROG" -cf html.tar html if test "x$GZIP_PROG" != "xNOTFOUND" ; then if test "x$RM_PROG" != "xNOTFOUND" ; then - $RM_PROG -f html.tar.gz + "$RM_PROG" -f html.tar.gz fi - $GZIP_PROG html.tar - $MV_PROG -f html.tar.gz "$RESULTING_HTML_TARZ_ARCHIVE_FILE" + "$GZIP_PROG" html.tar + "$MV_PROG" -f html.tar.gz "$RESULTING_HTML_TARZ_ARCHIVE_FILE" fi fi fi @@ -230,18 +230,18 @@ fi # Clean-up. if test "x$RM_PROG" != "xNOTFOUND" ; then - $RM_PROG -fr "$INTERMEDIATE_DOX_DIR" + "$RM_PROG" -fr "$INTERMEDIATE_DOX_DIR" if test "x$DOWNLOAD_VTK_TAGFILE" == "xON" ; then if test "x$VTK_TAGFILE" != "x" ; then - $RM_PROG -f "$VTK_TAGFILE_DEST_DIR/$VTK_TAGFILE" + "$RM_PROG" -f "$VTK_TAGFILE_DEST_DIR/$VTK_TAGFILE" fi fi if test "x$COMPILE_HTML_HELP" == "xON" ; then if test "x$RESULTING_HTML_HELP_FILE" != "x" ; then if test "x$ALLOW_ERASE_OUTPUT_DIRECTORY" == "xON" ; then - $RM_PROG -fr "$OUTPUT_DIRECTORY" + "$RM_PROG" -fr "$OUTPUT_DIRECTORY" fi fi fi diff --git a/Utilities/Release/dashmacmini5_release.cmake b/Utilities/Release/dashmacmini5_release.cmake index bc95982..b407554 100644 --- a/Utilities/Release/dashmacmini5_release.cmake +++ b/Utilities/Release/dashmacmini5_release.cmake @@ -20,7 +20,7 @@ CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CPACK_SYSTEM_NAME:STRING=Darwin-x86_64 BUILD_QtDialog:BOOL=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE -QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Support/qt-4.8.0/install/bin/qmake +QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Support/qt-4.8.6/install/bin/qmake ") get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) include(${path}/release_cmake.cmake) diff --git a/Utilities/Release/linux64_release.cmake b/Utilities/Release/linux64_release.cmake index 513f42f..265e0d7 100644 --- a/Utilities/Release/linux64_release.cmake +++ b/Utilities/Release/linux64_release.cmake @@ -11,9 +11,9 @@ CURSES_LIBRARY:FILEPATH=/home/kitware/ncurses-5.9/lib/libncurses.a CURSES_INCLUDE_PATH:PATH=/home/kitware/ncurses-5.9/include FORM_LIBRARY:FILEPATH=/home/kitware/ncurses-5.9/lib/libform.a CMAKE_USE_OPENSSL:BOOL=ON -OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1j/lib/libcrypto.a -OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.1j/include -OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1j/lib/libssl.a +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2c/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2c/include +OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2c/lib/libssl.a CPACK_SYSTEM_NAME:STRING=Linux-x86_64 BUILD_QtDialog:BOOL:=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE diff --git a/Utilities/Release/magrathea_release.cmake b/Utilities/Release/magrathea_release.cmake index 1bf75dd..79fa319 100644 --- a/Utilities/Release/magrathea_release.cmake +++ b/Utilities/Release/magrathea_release.cmake @@ -11,9 +11,9 @@ CURSES_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libncurses.a CURSES_INCLUDE_PATH:PATH=/usr/i686-gcc-332s/include/ncurses FORM_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libform.a CMAKE_USE_OPENSSL:BOOL=ON -OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1g-install/lib/libcrypto.a -OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.1g-install/include -OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1g-install/lib/libssl.a +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2c/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2c/include +OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2c/lib/libssl.a CPACK_SYSTEM_NAME:STRING=Linux-i386 BUILD_QtDialog:BOOL:=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake index 98fe3c5..ac41300 100644 --- a/Utilities/Release/upload_release.cmake +++ b/Utilities/Release/upload_release.cmake @@ -1,6 +1,6 @@ set(CTEST_RUN_CURRENT_SCRIPT 0) if(NOT VERSION) - set(VERSION 3.2) + set(VERSION 3.3) endif() if(NOT DEFINED PROJECT_PREFIX) set(PROJECT_PREFIX cmake-${VERSION}) @@ -299,6 +299,7 @@ CMAKE_CXX_SOURCES="\ cmMakefileLibraryTargetGenerator \ cmMakefileTargetGenerator \ cmMakefileUtilityTargetGenerator \ + cmOutputConverter \ cmOSXBundleGenerator \ cmNewLineStyle \ cmBootstrapCommands1 \ |