summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Atkins <chuck.atkins@kitware.com>2020-12-22 21:11:34 (GMT)
committerBrad King <brad.king@kitware.com>2021-03-31 13:14:45 (GMT)
commit27579e9cf12a9994fc15ff9e5487f73cc0406428 (patch)
tree547baebe2c46fbb4ef8ce37ebb65a2fc834b623b
parenta55feff69c7967d56e0935d841cf1ea2c980a43a (diff)
downloadCMake-27579e9cf12a9994fc15ff9e5487f73cc0406428.zip
CMake-27579e9cf12a9994fc15ff9e5487f73cc0406428.tar.gz
CMake-27579e9cf12a9994fc15ff9e5487f73cc0406428.tar.bz2
FujitsuClang: Add support for the Fujitsu compiler in Clang mode
This should be front end compatible with vanilla clang but giving it a unique identifier allows a project to pass additional options unique to Fujitsu and outside the scope of a CMake builtin.
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_ID.rst1
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake1
-rw-r--r--Modules/CMakePlatformId.h.in2
-rw-r--r--Modules/Compiler/Fujitsu-DetermineCompiler.cmake2
-rw-r--r--Modules/Compiler/FujitsuClang-C.cmake6
-rw-r--r--Modules/Compiler/FujitsuClang-CXX.cmake6
-rw-r--r--Modules/Compiler/FujitsuClang-DetermineCompiler.cmake9
-rw-r--r--Modules/Compiler/FujitsuClang.cmake11
-rw-r--r--Modules/Platform/Linux-Fujitsu-C.cmake1
-rw-r--r--Modules/Platform/Linux-Fujitsu-CXX.cmake9
10 files changed, 39 insertions, 9 deletions
diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
index c4f61a9..0abedde 100644
--- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst
+++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
@@ -20,6 +20,7 @@ include:
Embarcadero, Borland = Embarcadero (embarcadero.com)
Flang = Flang LLVM Fortran Compiler
Fujitsu = Fujitsu HPC compiler (Trad mode)
+ FujitsuClang = Fujitsu HPC compiler (Clang mode)
G95 = G95 Fortran (g95.org)
GNU = GNU Compiler Collection (gcc.gnu.org)
GHS = Green Hills Software (www.ghs.com)
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index 214d58a..c79d423 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -66,6 +66,7 @@ function(compiler_id_detection outvar lang)
PGI
Cray
TI
+ FujitsuClang
Fujitsu
GHS
)
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
index 3ae9f49..2643874 100644
--- a/Modules/CMakePlatformId.h.in
+++ b/Modules/CMakePlatformId.h.in
@@ -285,6 +285,8 @@ char const info_version_internal[] = {
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
'i','n','t','e','r','n','a','l','[',
COMPILER_VERSION_INTERNAL,']','\0'};
+#elif defined(COMPILER_VERSION_INTERNAL_STR)
+char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
#endif
/* Construct a string literal encoding the version number components. */
diff --git a/Modules/Compiler/Fujitsu-DetermineCompiler.cmake b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake
index a8c655d..8534916 100644
--- a/Modules/Compiler/Fujitsu-DetermineCompiler.cmake
+++ b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake
@@ -1,5 +1,5 @@
-set(_compiler_id_pp_test "defined(__FUJITSU) && !defined(__CLANG_FUJITSU)")
+set(_compiler_id_pp_test "defined(__FUJITSU)")
set(_compiler_id_version_compute "
# if defined(__FCC_version__)
diff --git a/Modules/Compiler/FujitsuClang-C.cmake b/Modules/Compiler/FujitsuClang-C.cmake
new file mode 100644
index 0000000..f700d2d
--- /dev/null
+++ b/Modules/Compiler/FujitsuClang-C.cmake
@@ -0,0 +1,6 @@
+include(Compiler/FujitsuClang)
+
+set(_fjclang_ver "${CMAKE_C_COMPILER_VERSION_INTERNAL}")
+set(CMAKE_C_COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION_INTERNAL}")
+include(Compiler/Clang-C)
+set(CMAKE_C_COMPILER_VERSION "${_fjclang_ver}")
diff --git a/Modules/Compiler/FujitsuClang-CXX.cmake b/Modules/Compiler/FujitsuClang-CXX.cmake
new file mode 100644
index 0000000..c8790cd
--- /dev/null
+++ b/Modules/Compiler/FujitsuClang-CXX.cmake
@@ -0,0 +1,6 @@
+include(Compiler/FujitsuClang)
+
+set(_fjclang_ver "${CMAKE_CXX_COMPILER_VERSION_INTERNAL}")
+set(CMAKE_CXX_COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION_INTERNAL}")
+include(Compiler/Clang-CXX)
+set(CMAKE_CXX_COMPILER_VERSION "${_fjclang_ver}")
diff --git a/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake b/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake
new file mode 100644
index 0000000..f6719b1
--- /dev/null
+++ b/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake
@@ -0,0 +1,9 @@
+
+set(_compiler_id_pp_test "defined(__CLANG_FUJITSU)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__FCC_major__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__FCC_minor__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__FCC_patchlevel__)
+# define @PREFIX@COMPILER_VERSION_INTERNAL_STR __clang_version__
+")
diff --git a/Modules/Compiler/FujitsuClang.cmake b/Modules/Compiler/FujitsuClang.cmake
new file mode 100644
index 0000000..a848248
--- /dev/null
+++ b/Modules/Compiler/FujitsuClang.cmake
@@ -0,0 +1,11 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple languages; use include blocker.
+if(__COMPILER_FUJITSUCLANG)
+ return()
+endif()
+set(__COMPILER_FUJITSUCLANG 1)
+
+include(Compiler/Clang)
diff --git a/Modules/Platform/Linux-Fujitsu-C.cmake b/Modules/Platform/Linux-Fujitsu-C.cmake
new file mode 100644
index 0000000..e37573d
--- /dev/null
+++ b/Modules/Platform/Linux-Fujitsu-C.cmake
@@ -0,0 +1 @@
+include(Platform/Linux-Clang-C)
diff --git a/Modules/Platform/Linux-Fujitsu-CXX.cmake b/Modules/Platform/Linux-Fujitsu-CXX.cmake
index d72dd49..5257f13 100644
--- a/Modules/Platform/Linux-Fujitsu-CXX.cmake
+++ b/Modules/Platform/Linux-Fujitsu-CXX.cmake
@@ -1,8 +1 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details
-
-include(Platform/Linux-Fujitsu)
-__linux_compiler_fujitsu(CXX)
-
-# Special sauce to propagate the -std=xxx flag when linking
-set(CMAKE_CXX_LINK_WITH_STANDARD_COMPILE_OPTION ON)
+include(Platform/Linux-Clang-CXX)