Commit Graph

60 Commits

Author SHA1 Message Date
Kitware Robot
1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
Kitware Robot
0b96ae1f6a Revise C++ coding style using clang-format with "east const"
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Issue: #26123
2025-01-23 13:09:50 -05:00
Alex Turbov
6e3e8827fa Refactor: cmGlobalGeneratorFactory::GetDocumentation returns entry
Before, a documentation entry was in/out parameter.
Now it's a normal return value.

This also makes possible to eliminate defaulted default ctor
for `cmDocumentationEntry` for C++ 11.

Also, simplify `cmake::AppendGlobalGeneratorsDocumentation()`.
2022-11-17 16:37:13 +04:00
Fred Baksik
93c1acd8ff GHS: List predefined targets before user targets in GUI 2022-03-17 19:11:47 -04:00
Fred Baksik
b3e9c72901 GHS: use INSTALL target
For consistancy use upper case install for pre-defined targets.
2022-03-17 19:11:45 -04:00
Fred Baksik
edff0f6a1d GHS: Use Custom Target for ALL_BUILD
Use a Custom Target for ALL_BUILD instead of special code.

This also changes the name from <project>.ALL_BUILD.tgt to
ALL_BUILD.tgt.  The name change is part of standardizing the
CMakePredefinedTargets names.
2022-03-17 19:11:43 -04:00
Fred Baksik
ad426aa697 GHS: Create RERUN_CMAKE Custom Target
Create a Custom Target that will re-run CMake on user demand if any of
the CMake input files have changed.
2022-03-17 19:11:42 -04:00
Carsten Rudolph
193b8fca52 cmBuildOptions: Split build arguments into separate object. 2022-01-22 06:35:38 -05:00
Fred Baksik
0427f22539 GHS: Update RTOS selection logic
Selection of an RTOS only needs to be performed if not set by user.

Avoid CMake developer warnings for setting GHS_OS_DIR multiple times.
Instead only set it once after searching has been performed.

Remove all the logic for printing error and status messages about RTOS
selection.  This was broken and reporting incorrect messages.  These
messages also breaks CMake tests.

NOTE: If RTOS selection fails then the compiler checks will result in
a build error.  The build error will report that the RTOS
"GHS_OS_DIR-NOT-SPECIFIED" does not exist.
2021-11-15 13:15:11 -05:00
Fred Baksik
83eb5695e9 GHS: Update toolset selection logic
-- Ensure that GHS_TOOLSET_ROOT is used as a path
   * Converts directory path slashes to CMake style
-- Use ComparePath() to properly check for path changes of build tool
   * Accounts for Windows file-system case insensitivity.
-- Don't print message "defaulting" messages (this causes CMake test failures)
-- Don't force update CMAKE_GENERATOR_TOOLSET back into cache when `-T`
   is not used on initial configure. This change avoids an unnessary
   error message when accidentally using `-T` in subsequent runs but the same
   tools are always used.
-- Use IssueMessage() for error messages.
2021-11-15 13:15:10 -05:00
Brad King
09bee3bee1 cmGlobalGhsMultiGenerator: Simplify relative path conversion logic
Our call to `MaybeConvertToRelativePath` uses paths that always pass the
"maybe" checks.  Use `ForceToRelativePath` directly.
2021-05-12 15:53:26 -04:00
Kitware Robot
bdca8b01d2 Modernize: Use #pragma once in all header files
#pragma once is a widely supported compiler pragma, even though it is
not part of the C++ standard. Many of the issues keeping #pragma once
from being standardized (distributed filesystems, build farms, hard
links, etc.) do not apply to CMake - it is easy to build CMake on a
single machine. CMake also does not install any header files which can
be consumed by other projects (though cmCPluginAPI.h has been
deliberately omitted from this conversion in case anyone is still using
it.) Finally, #pragma once has been required to build CMake since at
least August 2017 (7f29bbe6 enabled server mode unconditionally, which
had been using #pragma once since September 2016 (b13d3e0d)). The fact
that we now require C++11 filters out old compilers, and it is unlikely
that there is a compiler which supports C++11 but does not support
#pragma once.
2020-09-03 09:30:21 -04:00
Vitaly Stakhovsky
db17de2438 GHS: Use cm::erase in place of loop 2020-03-10 14:25:36 -04:00
Marc Chevrier
a00960288b GlobalGenerator family: modernize memory management 2020-01-07 11:03:11 +01:00
Marc Chevrier
36c8cae2e8 cmLocalGenerator: modernize memory management 2019-12-10 00:24:06 +01:00
Alexander Boczar
99e83d4235 cmake: Teach --build mode to load CMAKE_GENERATOR_TOOLSET
Extend the `cmGlobalGenerator::SetGeneratorToolset` signature to
indicate when it is called from `cmake::build`.
2019-10-15 13:28:41 -04:00
Kitware Robot
ed98209ddc Revise include order using clang-format-6.0
Run the `clang-format.bash` script to update our C and C++ code to a new
include order `.clang-format`.  Use `clang-format` version 6.0.
2019-10-01 12:26:36 -04:00
Regina Pfeifer
a1ddf2d0ba clang-tidy: Replace typedef with using
Automate the conversion with

  perl -i -0pe 's/typedef ([^;]*) ([^ ]+);/using $2 = $1;/g'

then manually fix a few places.
2019-09-04 18:03:01 +02:00
Regina Pfeifer
62e5f72289 clang-tidy: Replace typedef with using 2019-09-03 13:21:26 -04:00
Fred Baksik
83c47ef5b8 GHS: Update project layout to accommodate gbuild inconsistencies
-- Do not use reference projects, use build hierarchy instead.
   gbuild has three parallel levels:
   * low -- Parallelizes compiling source files within a single project (.gpj)
     file when safe to do so.
   * medium -- Parallelizes processing files within a single linked output when
     safe to do so.
   * high [default] -- Parallelizes processing files whenever safe to do so,
     including linking task.

   Testing showed that for some combinations of gbuild / MULTI there are issues
   with building a project that uses references to target project files along with
   using {nobuild} option.

   Sometimes the archiving of a library and linking of an executable were
   happening in parallel and the build would fail when linking because the
   archive wasn't complete.

   This behavior was also inconsistent when running the build from MULTI and
   from the command line with gbuild. In some cases MULTI did not parallelize
   archiving and linking, but gbuild performed these actions in parallel.

   The parallel build issue was not seen when using a build hierarchy where the
   project listed the project files normally instead of using a reference link.

   The other option was to add the -parallel_level=medium to the command line
   when using "cmake --build" but this wouldn't fix the issue if gbuild itself
   was used to and the user might not be aware of the extra option used by cmake.
2019-04-11 13:15:51 -04:00
Fred Baksik
5d2e1404bd GHS: Update project layout to build targets correctly
-- Restructure projects and files to support proper building of targets
   Build order is determined by hierarchy of project files and folders
   Custom targets may have been run multiple times in the original file / folder structure
-- Default to build targets that are part of ALL target
-- List all known targets for this project
   Includes global targets for ALL_BUILD and INSTALL
-- Compute build order for building targets
2019-04-11 13:15:50 -04:00
Fred Baksik
b6bfa7eeb2 GHS: Support add_dependencies() command
-- use references to list target dependencies
2019-04-11 13:15:50 -04:00
Fred Baksik
39ee9718d9 GHS: Support add_custom_target() command
-- add new project type that runs shell scripts in proper order
2019-04-11 13:15:50 -04:00
Fred Baksik
8d3dad9a76 GHS: Support add_custom_command( OUTPUT ) signature
-- add new file type to run a shell script
-- gbuild does not compute interfile dependencies like other build tools.
   Therefore calculate the required build order of custom commands and
   list all of them in the CMake Rules subproject.
2019-04-11 13:15:50 -04:00
Brad King
c756fbce9b Merge topic 'ghs_os_dir'
a1e6b414b9 GHS: Update GHS_BSP_NAME processing
266dadf868 GHS: Print status message regarding GHS_OS_DIR

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3123
2019-04-08 07:45:13 -04:00
Sebastian Holtermann
735c6f39d9 Fix invalid ///! doxygen comment line starts
In various places `///!` was used to start a comment line.  This is not valid
Doygen syntax.  This patch replaces `///!` comment starts with `//!`.
2019-03-31 11:27:12 +02:00
Fred Baksik
266dadf868 GHS: Print status message regarding GHS_OS_DIR
-- Rename platform script so it runs before initial try_compile() in
   project() command.
-- Fix incorrect variable name GHS_OS_DIR_OPTION
-- Remove unnecessary ".*" from REGEX expression for GHS_CANDIDATE_OS_DIRS
-- Forward GHS_OS_DIR_OPTION to try_compile() and preserve trailing
   whitespace of the variable.
2019-03-29 12:38:12 -04:00
Brad King
f7dca1fc97 GHS: Fix include-what-you-use and clang-tidy diagnostics
We will soon build GHS sources on Linux where we run these lints.
2019-03-20 09:48:29 -04:00
Bartosz Kosiorek
324d18bb34 cmake: Teach --build mode to support multiple targets
Fixes: #16136
2019-03-05 08:55:28 -05:00
Robert Maynard
1a45266cb5 cmGlobalGenerator: Add a class that represent the build command
This refactors a std::vector<std::string> into a class so that
we can extend the features to represent things such as multiple
chained commands in the future.
2019-01-25 08:20:02 -05:00
Fred Baksik
4a1ec0de3d GHS: Fix toolset selection
-- Allow -T to accept full or partial paths
-- Use "C:/ghs" if GHS_TOOLSET_ROOT is empty string
-- Put more information in error messages
2019-01-16 10:41:56 -05:00
Fred Baksik
14f3ba2059 GHS: EXCLUDE_FROM_ALL updates
-- Excluded targets should be generated but not included in build ALL
-- Use the correct source list for this configuration when writing sources
2019-01-16 10:41:38 -05:00
Fred Baksik
b2a72ec72d GHS: Cleanup unused file handling functions and file output updates
-- File handling cleanup
-- Rename some functions to clarify what they do
-- Update to source file path conversion; only perform conversion when using windows
2019-01-16 10:41:31 -05:00
Fred Baksik
2ed2d6b46f GHS: Place build system outputs per target output directives
-- Set output and object file locations
-- Suffixes are no longer being forced but will now follow the target properties
   By default GHS tools have no suffix for executable files so
   CMAKE_EXECUTABLE_SUFFIX was changed to meet this behavior
-- Remove #if 0 blocked out code; it has been replaced.
   Forcing the -relprog option has been removed from non-kernel executable targets.
   The default value of this option (if it is even available) is determined by the
   tool-chain for the specified target and platform (Some tool-chains default to
   -locatedprogram).  The use of -relprog can have unexpected results as it cannot
   always produce a fully relocated executable.
-- Clarify use of CMAKE_BUILD_TYPE to control build configuration
2019-01-16 10:41:24 -05:00
Fred Baksik
ead7117afd GHS: Update the top-level project generation
-- Sort targets by name
-- Generate a top-level project for each project command named as project.top.gpj
   Use the target set for the current project instead of assuming all targets
-- Add support for building projects not in binary root
-- Directly create files and pass ostream
-- Do no generate project files for UTILITY targets; this was never supported
-- Do no generate project files for OBJECT, SHARED, or MODULE libraries; this was never supported
-- Update GHS tags to support project types
   NOTE: The default tag is changed to "" because "[ ]" is an invalid token in project file
2019-01-16 10:41:20 -05:00
Fred Baksik
6436080996 GHS: Have the top-level project name follow the specified project name 2019-01-16 10:41:07 -05:00
Fred Baksik
a42e40e78d GHS: Only print bsp and os directives if specified by user
-- standalone platforms will not build if bsp/os is specified in project file
-- integrity platforms will always print these directives because they are required
-- cleanup -os_dir setting
   allow customization of the actual setting because it is determined by tool-set customization files
   remove variable that was set but never used
-- add message when using default values
2019-01-16 10:40:59 -05:00
Vitaly Stakhovsky
94632087b2 Add missing override 2018-12-30 12:32:55 -05:00
Fred Baksik
a37a4a00c8 GHS: Add toolset selection support
-- Use the specified toolset located within GHS_TOOLSET_ROOT
-- Update how the latest toolset is determined; scan the location GHS_TOOLSET_ROOT and sort it
   No longer use registry settings looking for installations
     The registry values are assigned in installation order for Green Hills tools not version order
-- Update to use gbuild.exe from the proper toolset
-- Clarify that CMAKE_MAKE_PROGRAM should not be set by user.
-- Detect some toolset changes when regenerating project files
   This could occur if GHS_TOOLSET_ROOT was changed by user after the initial project generation
   This could occur if CMAKE_MAKE_PROGRAM was changed at the command line
-- Use placeholder values for CMAKE_<LANG>_COMPILER
   The MULTI build system only uses gbuild to build a project
     gbuild uses the project file to determine which set of compilers to use based on target platform and architecture
     because compiler detection is skipped, placeholder values are used so that CMake does not complain
2018-07-11 08:28:36 -04:00
Fred Baksik
5d40d2b44f GHS: Support ARM, PPC, 86 architectures
-- Update -A option to choose target architecture.
-- Update commentary about which variables are used to control toolset and target settings
-- Remove setting CMAKE_SYSTEM_PROCESSOR because the value is overwritten to be "" by subsequent CMAKE processing
2018-07-07 07:27:21 -04:00
Brad King
b41b30f16e Update use of KWSys SystemTools::SplitString for new signature 2018-06-22 13:38:18 -04:00
Kitware Robot
d7204e649e Revise C++ coding style using clang-format-6.0
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 6.0.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2018-06-01 09:53:42 -04:00
Florian Maushart
1ab3881ec9 cmake: Add options for parallel builds to --build mode
While we already support `cmake --build . -- -j`, the options after `--`
are specific to the native build tool.  Add new options `--parallel
[<N>]` and `-j [<N>]` to abstract this and map to the proper option
for the native build tool.
2018-05-25 09:42:20 -04:00
Brad King
0b33aee48b Use C++11 override instead of CM_OVERRIDE
We now require C++11 support including `override`.  Drop use of
the old compatibility macro.  Convert references as follows:

    git grep -l CM_OVERRIDE -- '*.h' '*.hxx' '*.cxx' |
      xargs sed -i 's/CM_OVERRIDE/override/g'
2017-09-15 10:06:41 -04:00
Aaron Orenstein
7bc6577017 Performance: Fix a few more unnecessary vector copies missed in af3fd6f 2017-08-18 07:59:52 -07:00
Brad King
2d3aa94225 cmGlobalGenerator: Allow FindMakeProgram to fail
Revise its signature to return `bool` so that it can fail and abort
configuration early.
2016-10-20 10:37:27 -04:00
Brad King
86578eccf2 Simplify CMake per-source license notices
Per-source copyright/license notice headers that spell out copyright holder
names and years are hard to maintain and often out-of-date or plain wrong.
Precise contributor information is already maintained automatically by the
version control tool.  Ultimately it is the receiver of a file who is
responsible for determining its licensing status, and per-source notices are
merely a convenience.  Therefore it is simpler and more accurate for
each source to have a generic notice of the license name and references to
more detailed information on copyright holders and full license terms.

Our `Copyright.txt` file now contains a list of Contributors whose names
appeared source-level copyright notices.  It also references version control
history for more precise information.  Therefore we no longer need to spell
out the list of Contributors in each source file notice.

Replace CMake per-source copyright/license notice headers with a short
description of the license and links to `Copyright.txt` and online information
available from "https://cmake.org/licensing".  The online URL also handles
cases of modules being copied out of our source into other projects, so we
can drop our notices about replacing links with full license text.

Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority
of the replacements mechanically.  Manually fix up shebang lines and trailing
newlines in a few files.  Manually update the notices in a few files that the
script does not handle.
2016-09-27 15:14:44 -04:00
Tobias Hunger
4db08807db CMake: Report whether generators support platforms 2016-07-14 10:35:58 -04:00
Kitware Robot
d9fd2f5402 Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2016-05-16 16:05:19 -04:00
Brad King
e1c7747253 Format include directive blocks and ordering with clang-format
Sort include directives within each block (separated by a blank line) in
lexicographic order (except to prioritize `sys/types.h` first).  First
run `clang-format` with the config file:

    ---
    SortIncludes: false
    ...

Commit the result temporarily.  Then run `clang-format` again with:

    ---
    SortIncludes: true
    IncludeCategories:
      - Regex:    'sys/types.h'
        Priority: -1
    ...

Commit the result temporarily.  Start a new branch and cherry-pick the
second commit.  Manually resolve conflicts to preserve indentation of
re-ordered includes.  This cleans up the include ordering without
changing any other style.

Use the following command to run `clang-format`:

    $ git ls-files -z -- \
        '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' |
      egrep -z -v '(Lexer|Parser|ParserHelper)\.' |
      egrep -z -v '^Source/cm_sha2' |
      egrep -z -v '^Source/(kwsys|CursesDialog/form)/' |
      egrep -z -v '^Utilities/(KW|cm).*/' |
      egrep -z -v '^Tests/Module/GenerateExportHeader' |
      egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' |
      xargs -0 clang-format -i

This selects source files that do not come from a third-party.

Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
2016-04-29 13:58:54 -04:00