This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, master has been updated via 48459ab820a3a72e83336a120327eb9425732865 (commit) via 0bf7a93f91de33bee151fc36c373a9f64f5db6c2 (commit) via fa1fe09dbbf8e18e02a67dc20adb3cb523418ef6 (commit) via 667f2861dcfc153caf7ae610a61b6b6bbc3445f0 (commit) via 53f95dc5fb161ed92fb9fcb8ecc31502c5e6417e (commit) via 8347c75d1e818154f13d7076966aedf3fb9f2c08 (commit) via 7b89ae8d7bb28d4e5a4fc64a12035d2db1f3765d (commit) via ede1bebd50af00fd6c657e6c5173cbaa71cb704c (commit) via eaebd4fc47e9f438607b5585b8a67df146dab8f6 (commit) via 308990b2bcf1a824cb641a31c7a63f0dbf8f7498 (commit) via 08173075c185da050f5aa58e4bd9b5fa6659c63e (commit) via 9276beae5e2ce958e4c88995af56fe580d894d8b (commit) via f7acc1266c64be58793cf926b41f0d58b5a55e2a (commit) via 8065a686ddcb54b10fd6758eca24280f3e68926b (commit) via 409891baf77b909d414add64268d1e5530ff6086 (commit) from 61c6d49f5a2f3024aca81bb1535ab804f94adfba (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=48459ab820a3a72e83336a120327eb9425732865 commit 48459ab820a3a72e83336a120327eb9425732865 Merge: 0bf7a93f91 fa1fe09dbb Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Oct 21 11:29:45 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Oct 21 11:29:45 2019 -0400 Merge branch 'release-3.16' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0bf7a93f91de33bee151fc36c373a9f64f5db6c2 commit 0bf7a93f91de33bee151fc36c373a9f64f5db6c2 Merge: 667f2861dc 9276beae5e Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Oct 21 15:29:01 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Mon Oct 21 11:29:12 2019 -0400 Merge topic 'ccmake-clear-help' 9276beae5e ccmake: Fully clear the 1st help line when processing Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3937 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=667f2861dcfc153caf7ae610a61b6b6bbc3445f0 commit 667f2861dcfc153caf7ae610a61b6b6bbc3445f0 Merge: 53f95dc5fb f7acc1266c Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Oct 21 15:23:53 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Mon Oct 21 11:24:28 2019 -0400 Merge topic 'project-include-before' f7acc1266c project: Add variable CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3936 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=53f95dc5fb161ed92fb9fcb8ecc31502c5e6417e commit 53f95dc5fb161ed92fb9fcb8ecc31502c5e6417e Merge: 8347c75d1e 8065a686dd Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Oct 21 15:23:35 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Mon Oct 21 11:23:47 2019 -0400 Merge topic 'export-compile-commands-environment-variable' 8065a686dd Initialize CMAKE_EXPORT_COMPILE_COMMANDS from envvar of the same name Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3914 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8347c75d1e818154f13d7076966aedf3fb9f2c08 commit 8347c75d1e818154f13d7076966aedf3fb9f2c08 Merge: 7b89ae8d7b eaebd4fc47 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Oct 21 11:21:50 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Oct 21 11:21:50 2019 -0400 Merge branch 'release-3.16' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7b89ae8d7bb28d4e5a4fc64a12035d2db1f3765d commit 7b89ae8d7bb28d4e5a4fc64a12035d2db1f3765d Merge: ede1bebd50 08173075c1 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Oct 21 11:21:43 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Oct 21 11:21:43 2019 -0400 Merge branch 'release-3.15' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ede1bebd50af00fd6c657e6c5173cbaa71cb704c commit ede1bebd50af00fd6c657e6c5173cbaa71cb704c Merge: 61c6d49f5a 409891baf7 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Oct 21 15:20:17 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Mon Oct 21 11:20:33 2019 -0400 Merge topic 'FindOpenMP-include-dir' 409891baf7 FindOpenMP: Allow try_compile() to find omp.h for AppleClang Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3916 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=08173075c185da050f5aa58e4bd9b5fa6659c63e commit 08173075c185da050f5aa58e4bd9b5fa6659c63e Merge: 83dbef1135 c684db4ea8 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Oct 21 10:26:48 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Oct 21 10:26:48 2019 -0400 Merge branch 'doc-genex-tweak' into release-3.15 Merge-request: !3939 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f7acc1266c64be58793cf926b41f0d58b5a55e2a commit f7acc1266c64be58793cf926b41f0d58b5a55e2a Author: Deniz Bahadir <dbaha...@benocs.com> AuthorDate: Fri Oct 18 12:51:26 2019 +0200 Commit: Brad King <brad.k...@kitware.com> CommitDate: Fri Oct 18 14:44:24 2019 -0400 project: Add variable CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE Follow up commit 0761186949 (project: Add variable CMAKE_PROJECT_INCLUDE_BEFORE, 2019-03-28, v3.15.0-rc1~294^2) with a project-specific variant. This variable will be used similar to the already existing `CMAKE_PROJECT_INCLUDE_BEFORE` and `CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE` variables. Fixes: #19854 diff --git a/Help/command/project.rst b/Help/command/project.rst index 395145619f..b6093d3b71 100644 --- a/Help/command/project.rst +++ b/Help/command/project.rst @@ -102,9 +102,12 @@ options are intended for use as default values in package metadata and documenta Code Injection ^^^^^^^^^^^^^^ -If the :variable:`CMAKE_PROJECT_INCLUDE_BEFORE` variable is set, the file -pointed to by that variable will be included as the first step of the +If the :variable:`CMAKE_PROJECT_INCLUDE_BEFORE` or +:variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE` variables are set, +the files they point to will be included as the first step of the ``project()`` command. +If both are set, then :variable:`CMAKE_PROJECT_INCLUDE_BEFORE` will be +included before :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE`. If the :variable:`CMAKE_PROJECT_INCLUDE` or :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE` variables are set, the files diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index cad0df6daf..73f334f5ad 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -216,6 +216,7 @@ Variables that Change Behavior /variable/CMAKE_PROJECT_INCLUDE /variable/CMAKE_PROJECT_INCLUDE_BEFORE /variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE + /variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE_BEFORE /variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY /variable/CMAKE_STAGING_PREFIX /variable/CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS diff --git a/Help/variable/CMAKE_PROJECT_INCLUDE.rst b/Help/variable/CMAKE_PROJECT_INCLUDE.rst index 965c94ee7c..5835264497 100644 --- a/Help/variable/CMAKE_PROJECT_INCLUDE.rst +++ b/Help/variable/CMAKE_PROJECT_INCLUDE.rst @@ -5,5 +5,6 @@ A CMake language file or module to be included as the last step of all :command:`project` command calls. This is intended for injecting custom code into project builds without modifying their source. -See also the :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE` and +See also the :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE`, +:variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE` and :variable:`CMAKE_PROJECT_INCLUDE_BEFORE` variables. diff --git a/Help/variable/CMAKE_PROJECT_INCLUDE_BEFORE.rst b/Help/variable/CMAKE_PROJECT_INCLUDE_BEFORE.rst index 70b15e662f..280c14a0ea 100644 --- a/Help/variable/CMAKE_PROJECT_INCLUDE_BEFORE.rst +++ b/Help/variable/CMAKE_PROJECT_INCLUDE_BEFORE.rst @@ -5,5 +5,6 @@ A CMake language file or module to be included as the first step of all :command:`project` command calls. This is intended for injecting custom code into project builds without modifying their source. -See also the :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE` and +See also the :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE`, +:variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE` and :variable:`CMAKE_PROJECT_INCLUDE` variables. diff --git a/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst b/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst index 3485c38e44..74247f12b7 100644 --- a/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst +++ b/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst @@ -6,5 +6,6 @@ A CMake language file or module to be included as the last step of any name. This is intended for injecting custom code into project builds without modifying their source. -See also the :variable:`CMAKE_PROJECT_INCLUDE` and +See also the :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE`, +:variable:`CMAKE_PROJECT_INCLUDE` and :variable:`CMAKE_PROJECT_INCLUDE_BEFORE` variables. diff --git a/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE_BEFORE.rst b/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE_BEFORE.rst new file mode 100644 index 0000000000..db1432de65 --- /dev/null +++ b/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE_BEFORE.rst @@ -0,0 +1,11 @@ +CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE +------------------------------------------- + +A CMake language file or module to be included as the first step of any +:command:`project` command calls that specify ``<PROJECT-NAME>`` as the project +name. This is intended for injecting custom code into project builds without +modifying their source. + +See also the :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE`, +:variable:`CMAKE_PROJECT_INCLUDE` and +:variable:`CMAKE_PROJECT_INCLUDE_BEFORE` variables. diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index eb59b4f65a..1ce6c70f62 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -39,6 +39,11 @@ bool cmProjectCommand(std::vector<std::string> const& args, std::string const& projectName = args[0]; + if (!IncludeByVariable(status, + "CMAKE_PROJECT_" + projectName + "_INCLUDE_BEFORE")) { + return false; + } + mf.SetProjectName(projectName); mf.AddCacheDefinition(projectName + "_BINARY_DIR", diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index 03babd263a..85b96942ab 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -75,6 +75,12 @@ add_test(CMakeOnly.ProjectIncludeAny ${CMAKE_CMAKE_COMMAND} add_test(CMakeOnly.ProjectIncludeBefore ${CMAKE_CMAKE_COMMAND} -DTEST=ProjectIncludeBefore + -DCMAKE_ARGS=-DCMAKE_PROJECT_ProjectInclude_INCLUDE_BEFORE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectIncludeBefore/include.cmake + -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake + ) + +add_test(CMakeOnly.ProjectIncludeBeforeAny ${CMAKE_CMAKE_COMMAND} + -DTEST=ProjectIncludeBeforeAny -DCMAKE_ARGS=-DCMAKE_PROJECT_INCLUDE_BEFORE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectIncludeBefore/include.cmake -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake ) diff --git a/Tests/CMakeOnly/ProjectIncludeBeforeAny/CMakeLists.txt b/Tests/CMakeOnly/ProjectIncludeBeforeAny/CMakeLists.txt new file mode 100644 index 0000000000..5cd9cba2c0 --- /dev/null +++ b/Tests/CMakeOnly/ProjectIncludeBeforeAny/CMakeLists.txt @@ -0,0 +1,5 @@ +set(FOO TRUE) +project(ProjectInclude LANGUAGES NONE) +if(NOT AUTO_INCLUDE) + message(FATAL_ERROR "include file not found") +endif() diff --git a/Tests/CMakeOnly/ProjectIncludeBeforeAny/include.cmake b/Tests/CMakeOnly/ProjectIncludeBeforeAny/include.cmake new file mode 100644 index 0000000000..0a4799df35 --- /dev/null +++ b/Tests/CMakeOnly/ProjectIncludeBeforeAny/include.cmake @@ -0,0 +1,9 @@ +if(NOT FOO) + message(FATAL_ERROR "FOO is not set") +endif() + +if(NOT "${PROJECT_NAME}" STREQUAL "") + message(FATAL_ERROR "PROJECT_NAME should be empty") +endif() + +set(AUTO_INCLUDE TRUE) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8065a686ddcb54b10fd6758eca24280f3e68926b commit 8065a686ddcb54b10fd6758eca24280f3e68926b Author: Daan De Meyer <daan.j.deme...@gmail.com> AuthorDate: Sat Oct 12 18:49:04 2019 +0200 Commit: Brad King <brad.k...@kitware.com> CommitDate: Fri Oct 18 14:37:33 2019 -0400 Initialize CMAKE_EXPORT_COMPILE_COMMANDS from envvar of the same name Fixes: #18386 diff --git a/Help/envvar/CMAKE_EXPORT_COMPILE_COMMANDS.rst b/Help/envvar/CMAKE_EXPORT_COMPILE_COMMANDS.rst new file mode 100644 index 0000000000..e9e0810650 --- /dev/null +++ b/Help/envvar/CMAKE_EXPORT_COMPILE_COMMANDS.rst @@ -0,0 +1,9 @@ +CMAKE_EXPORT_COMPILE_COMMANDS +----------------------------- + +.. include:: ENV_VAR.txt + +The default value for :variable:`CMAKE_EXPORT_COMPILE_COMMANDS` when there +is no explicit configuration given on the first run while creating a new +build tree. On later runs in an existing build tree the value persists in +the cache as :variable:`CMAKE_EXPORT_COMPILE_COMMANDS`. diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst index 96ceb945a8..c98f18f681 100644 --- a/Help/manual/cmake-env-variables.7.rst +++ b/Help/manual/cmake-env-variables.7.rst @@ -23,6 +23,7 @@ Environment Variables that Control the Build /envvar/CMAKE_BUILD_PARALLEL_LEVEL /envvar/CMAKE_CONFIG_TYPE + /envvar/CMAKE_EXPORT_COMPILE_COMMANDS /envvar/CMAKE_GENERATOR /envvar/CMAKE_GENERATOR_INSTANCE /envvar/CMAKE_GENERATOR_PLATFORM diff --git a/Help/release/dev/export-compile-commands-environment-variable.rst b/Help/release/dev/export-compile-commands-environment-variable.rst new file mode 100644 index 0000000000..da9d66b721 --- /dev/null +++ b/Help/release/dev/export-compile-commands-environment-variable.rst @@ -0,0 +1,6 @@ +export-compile-commands-environment-variable +-------------------------------------------- + +* The :variable:`CMAKE_EXPORT_COMPILE_COMMANDS` variable now takes its + initial value from the :envvar:`CMAKE_EXPORT_COMPILE_COMMANDS` environment + variable if no explicit configuration is given. diff --git a/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst b/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst index 4548abcc73..6d2450bc70 100644 --- a/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst +++ b/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst @@ -25,6 +25,9 @@ form. The format of the JSON file looks like: } ] +This is initialized by the :envvar:`CMAKE_EXPORT_COMPILE_COMMANDS` environment +variable. + .. note:: This option is implemented only by :ref:`Makefile Generators` and the :generator:`Ninja`. It is ignored on other generators. diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 77d8cfd4fc..7efe5c4646 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -51,16 +51,16 @@ if(CMAKE_GENERATOR MATCHES "Make") set_property(GLOBAL PROPERTY TARGET_MESSAGES ${CMAKE_TARGET_MESSAGES}) endif() if(CMAKE_GENERATOR MATCHES "Unix Makefiles") - set(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL - "Enable/Disable output of compile commands during generation." + set(CMAKE_EXPORT_COMPILE_COMMANDS "$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" + CACHE BOOL "Enable/Disable output of compile commands during generation." ) mark_as_advanced(CMAKE_EXPORT_COMPILE_COMMANDS) endif() endif() if(CMAKE_GENERATOR MATCHES "Ninja") - set(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL - "Enable/Disable output of compile commands during generation." + set(CMAKE_EXPORT_COMPILE_COMMANDS "$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" + CACHE BOOL "Enable/Disable output of compile commands during generation." ) mark_as_advanced(CMAKE_EXPORT_COMPILE_COMMANDS) endif() diff --git a/Tests/EnforceConfig.cmake.in b/Tests/EnforceConfig.cmake.in index b7587aa47d..7781ded84a 100644 --- a/Tests/EnforceConfig.cmake.in +++ b/Tests/EnforceConfig.cmake.in @@ -33,5 +33,6 @@ unset(ENV{CMAKE_GENERATOR}) unset(ENV{CMAKE_GENERATOR_INSTANCE}) unset(ENV{CMAKE_GENERATOR_PLATFORM}) unset(ENV{CMAKE_GENERATOR_TOOLSET}) +unset(ENV{CMAKE_EXPORT_COMPILE_COMMANDS}) @TEST_HOME_ENV_CODE@ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index b608d334a7..f903c3d84a 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -254,6 +254,24 @@ function(run_EnvironmentGenerator) endfunction() run_EnvironmentGenerator() +function(run_EnvironmentExportCompileCommands) + set(RunCMake_TEST_SOURCE_DIR ${RunCMake_SOURCE_DIR}/env-export-compile-commands) + + run_cmake(env-export-compile-commands-unset) + + set(ENV{CMAKE_EXPORT_COMPILE_COMMANDS} ON) + run_cmake(env-export-compile-commands-set) + + set(RunCMake_TEST_OPTIONS -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF) + run_cmake(env-export-compile-commands-override) + + unset(ENV{CMAKE_EXPORT_COMPILE_COMMANDS}) +endfunction(run_EnvironmentExportCompileCommands) + +if(RunCMake_GENERATOR MATCHES "Unix Makefiles" OR RunCMake_GENERATOR MATCHES "Ninja") + run_EnvironmentExportCompileCommands() +endif() + 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/env-export-compile-commands-override-check.cmake b/Tests/RunCMake/CommandLine/env-export-compile-commands-override-check.cmake new file mode 100644 index 0000000000..032a1ae1e1 --- /dev/null +++ b/Tests/RunCMake/CommandLine/env-export-compile-commands-override-check.cmake @@ -0,0 +1,3 @@ +if(EXISTS "${RunCMake_TEST_BINARY_DIR}/compile_commands.json") + set(RunCMake_TEST_FAILED "compile_commands.json generated with CMAKE_EXPORT_COMPILE_COMMANDS overridden") +endif() diff --git a/Tests/RunCMake/CommandLine/env-export-compile-commands-set-check.cmake b/Tests/RunCMake/CommandLine/env-export-compile-commands-set-check.cmake new file mode 100644 index 0000000000..a749a55a47 --- /dev/null +++ b/Tests/RunCMake/CommandLine/env-export-compile-commands-set-check.cmake @@ -0,0 +1,3 @@ +if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/compile_commands.json") + set(RunCMake_TEST_FAILED "compile_commands.json not generated with CMAKE_EXPORT_COMPILE_COMMANDS set") +endif() diff --git a/Tests/RunCMake/CommandLine/env-export-compile-commands-unset-check.cmake b/Tests/RunCMake/CommandLine/env-export-compile-commands-unset-check.cmake new file mode 100644 index 0000000000..c5878f0634 --- /dev/null +++ b/Tests/RunCMake/CommandLine/env-export-compile-commands-unset-check.cmake @@ -0,0 +1,3 @@ +if(EXISTS "${RunCMake_TEST_BINARY_DIR}/compile_commands.json") + set(RunCMake_TEST_FAILED "compile_commands.json generated with CMAKE_EXPORT_COMPILE_COMMANDS unset") +endif() diff --git a/Tests/RunCMake/CommandLine/env-export-compile-commands/CMakeLists.txt b/Tests/RunCMake/CommandLine/env-export-compile-commands/CMakeLists.txt new file mode 100644 index 0000000000..aa6fbfd86d --- /dev/null +++ b/Tests/RunCMake/CommandLine/env-export-compile-commands/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.14) +project(env-export-compile-commands C) + +# Add target with a source file to make sure compile_commands.json gets +# generated. +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/main.c) +add_executable(env-export-compile-commands ${CMAKE_CURRENT_BINARY_DIR}/main.c) ----------------------------------------------------------------------- Summary of changes: Help/command/project.rst | 7 +++- Help/envvar/CMAKE_EXPORT_COMPILE_COMMANDS.rst | 9 +++++ Help/manual/cmake-env-variables.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 + ...xport-compile-commands-environment-variable.rst | 6 +++ Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst | 3 ++ Help/variable/CMAKE_PROJECT_INCLUDE.rst | 3 +- Help/variable/CMAKE_PROJECT_INCLUDE_BEFORE.rst | 3 +- .../CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst | 3 +- .../CMAKE_PROJECT_PROJECT-NAME_INCLUDE_BEFORE.rst | 11 ++++++ Modules/CMakeGenericSystem.cmake | 8 ++-- Modules/FindOpenMP.cmake | 43 +++++++++++++++++++++- Source/CursesDialog/cmCursesMainForm.cxx | 2 +- Source/cmProjectCommand.cxx | 5 +++ Tests/CMakeOnly/CMakeLists.txt | 6 +++ .../CMakeLists.txt | 0 .../include.cmake | 0 Tests/EnforceConfig.cmake.in | 1 + Tests/FindOpenMP/Test/CMakeLists.txt | 1 + Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 18 +++++++++ ...nv-export-compile-commands-override-check.cmake | 3 ++ .../env-export-compile-commands-set-check.cmake | 3 ++ .../env-export-compile-commands-unset-check.cmake | 3 ++ .../env-export-compile-commands/CMakeLists.txt | 7 ++++ 24 files changed, 136 insertions(+), 11 deletions(-) create mode 100644 Help/envvar/CMAKE_EXPORT_COMPILE_COMMANDS.rst create mode 100644 Help/release/dev/export-compile-commands-environment-variable.rst create mode 100644 Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE_BEFORE.rst copy Tests/CMakeOnly/{ProjectIncludeBefore => ProjectIncludeBeforeAny}/CMakeLists.txt (100%) copy Tests/CMakeOnly/{ProjectIncludeBefore => ProjectIncludeBeforeAny}/include.cmake (100%) create mode 100644 Tests/RunCMake/CommandLine/env-export-compile-commands-override-check.cmake create mode 100644 Tests/RunCMake/CommandLine/env-export-compile-commands-set-check.cmake create mode 100644 Tests/RunCMake/CommandLine/env-export-compile-commands-unset-check.cmake create mode 100644 Tests/RunCMake/CommandLine/env-export-compile-commands/CMakeLists.txt hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits