summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-11-29 13:25:44 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-11-29 13:32:26 (GMT)
commitc07b18d8835fbc4ddc0364f6f3531cc515f309fc (patch)
tree41a259caec80fc76547b6d66825368dfa7e6cb6e
parent71c28bddba25847f65cfebefe884d8e88eedc1af (diff)
parente04f1d1b47f395cd702574041aa17e52e71499d8 (diff)
downloadCMake-c07b18d8835fbc4ddc0364f6f3531cc515f309fc.zip
CMake-c07b18d8835fbc4ddc0364f6f3531cc515f309fc.tar.gz
CMake-c07b18d8835fbc4ddc0364f6f3531cc515f309fc.tar.bz2
Merge topic 'CodeBlocks-custom-compiler-id'
e04f1d1b CodeBlocks: add option for the CB compiler ID Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1512
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/release/dev/CodeBlocks-custom-compiler-id.rst6
-rw-r--r--Help/variable/CMAKE_CODEBLOCKS_COMPILER_ID.rst13
-rw-r--r--Modules/CMakeFindCodeBlocks.cmake3
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx7
5 files changed, 30 insertions, 0 deletions
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 0451466..1dce3e0 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -124,6 +124,7 @@ Variables that Change Behavior
/variable/CMAKE_AUTOMOC_RELAXED_MODE
/variable/CMAKE_BACKWARDS_COMPATIBILITY
/variable/CMAKE_BUILD_TYPE
+ /variable/CMAKE_CODEBLOCKS_COMPILER_ID
/variable/CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES
/variable/CMAKE_CODELITE_USE_TARGETS
/variable/CMAKE_COLOR_MAKEFILE
diff --git a/Help/release/dev/CodeBlocks-custom-compiler-id.rst b/Help/release/dev/CodeBlocks-custom-compiler-id.rst
new file mode 100644
index 0000000..893bd5c
--- /dev/null
+++ b/Help/release/dev/CodeBlocks-custom-compiler-id.rst
@@ -0,0 +1,6 @@
+CodeBlocks-custom-compiler-id
+-----------------------------
+
+* The :generator:`CodeBlocks` extra generator learned to check a
+ :variable:`CMAKE_CODEBLOCKS_COMPILER_ID` variable for a custom
+ compiler identification value to place in the project file.
diff --git a/Help/variable/CMAKE_CODEBLOCKS_COMPILER_ID.rst b/Help/variable/CMAKE_CODEBLOCKS_COMPILER_ID.rst
new file mode 100644
index 0000000..ad2709d
--- /dev/null
+++ b/Help/variable/CMAKE_CODEBLOCKS_COMPILER_ID.rst
@@ -0,0 +1,13 @@
+CMAKE_CODEBLOCKS_COMPILER_ID
+----------------------------
+
+Change the compiler id in the generated CodeBlocks project files.
+
+CodeBlocks uses its own compiler id string which differs from
+:variable:`CMAKE_<LANG>_COMPILER_ID`. If this variable is left empty,
+CMake tries to recognize the CodeBlocks compiler id automatically.
+Otherwise the specified string is used in the CodeBlocks project file.
+See the CodeBlocks documentation for valid compiler id strings.
+
+Other IDEs like QtCreator that also use the CodeBlocks generator may ignore
+this setting.
diff --git a/Modules/CMakeFindCodeBlocks.cmake b/Modules/CMakeFindCodeBlocks.cmake
index b76e5c5..13bceb1 100644
--- a/Modules/CMakeFindCodeBlocks.cmake
+++ b/Modules/CMakeFindCodeBlocks.cmake
@@ -28,3 +28,6 @@ endif()
# This variable is used by the CodeBlocks generator and appended to the make invocation commands.
set(CMAKE_CODEBLOCKS_MAKE_ARGUMENTS "${_CMAKE_CODEBLOCKS_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when CodeBlocks invokes make. Enter e.g. -j<some_number> to get parallel builds")
+
+# This variable is used by the CodeBlocks generator and allows the user to overwrite the autodetected CodeBlocks compiler id
+set(CMAKE_CODEBLOCKS_COMPILER_ID "" CACHE STRING "Id string of the compiler for the CodeBlocks IDE. Automatically detected when left empty")
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 76fc8f1..edce330 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -642,6 +642,13 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
// Translate the cmake compiler id into the CodeBlocks compiler id
std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
{
+ // allow the user to overwrite the detected compiler
+ std::string userCompiler =
+ mf->GetSafeDefinition("CMAKE_CODEBLOCKS_COMPILER_ID");
+ if (!userCompiler.empty()) {
+ return userCompiler;
+ }
+
// figure out which language to use
// for now care only for C, C++, and Fortran