From 3151024d241c581463d20bf0ce3d1060bdd22de4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 15 Jul 2014 11:01:36 +0200 Subject: QNX: Add missing flags for configurations and artifact creation. Commit v3.0.0-rc1~111^2 (QNX: Introduce QCC compiler id for that QNX platform compiler., 2014-01-20) split handling of the QNX QCC compiler into a separate compiler-id. That refactoring results in the QCC compiler not using the CMake-compiler-id "GNU", which means that the __compiler_gnu macro is no longer executed for it. Add Compiler/QCC*.cmake modules to define and call the __compiler_qcc macro and teach it to call __compiler_gnu internally. Remove the corresponding pieces from the Platform/QNX*.cmake modules. It is also necessary to change the language conditional to dereference the lang macro parameter, which is another bug introduced by the same commit. The extra -lang-c++ flag is only necessary when the CXX compiler is specified as 'qcc' instead of 'QCC' in the toolchain file, which is why this bug was not noticed before. The flag is also necessary in that case when linking in order to find the appropriate standard libraries. The flag was not previously added when linking executables, so linking failed even with CMake 2.8.12 with the lower-case compiler-id. Co-Author: Brad King --- Modules/Compiler/QCC-C.cmake | 2 ++ Modules/Compiler/QCC-CXX.cmake | 12 ++++++++++++ Modules/Compiler/QCC.cmake | 24 ++++++++++++++++++++++++ Modules/Platform/QNX-QCC-C.cmake | 4 ---- Modules/Platform/QNX-QCC-CXX.cmake | 4 ---- Modules/Platform/QNX.cmake | 22 +++------------------- 6 files changed, 41 insertions(+), 27 deletions(-) create mode 100644 Modules/Compiler/QCC-C.cmake create mode 100644 Modules/Compiler/QCC-CXX.cmake create mode 100644 Modules/Compiler/QCC.cmake delete mode 100644 Modules/Platform/QNX-QCC-C.cmake delete mode 100644 Modules/Platform/QNX-QCC-CXX.cmake diff --git a/Modules/Compiler/QCC-C.cmake b/Modules/Compiler/QCC-C.cmake new file mode 100644 index 0000000..ae4a2f4 --- /dev/null +++ b/Modules/Compiler/QCC-C.cmake @@ -0,0 +1,2 @@ +include(Compiler/QCC) +__compiler_qcc(C) diff --git a/Modules/Compiler/QCC-CXX.cmake b/Modules/Compiler/QCC-CXX.cmake new file mode 100644 index 0000000..a676bbe --- /dev/null +++ b/Modules/Compiler/QCC-CXX.cmake @@ -0,0 +1,12 @@ +include(Compiler/QCC) +__compiler_qcc(CXX) + +# If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the +# default for the driver is not c++. +set(CMAKE_CXX_COMPILE_OBJECT + " -lang-c++ -o -c ") + +set(CMAKE_CXX_LINK_EXECUTABLE + " -lang-c++ -o ") + +set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake new file mode 100644 index 0000000..76477e4 --- /dev/null +++ b/Modules/Compiler/QCC.cmake @@ -0,0 +1,24 @@ + +#============================================================================= +# Copyright 2002-2014 Kitware, Inc. +# +# 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. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) +include(Compiler/GNU) + +macro(__compiler_qcc lang) + __compiler_gnu(${lang}) + + # http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples + set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V") + + set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,") + set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,,-MT,,-MF,") +endmacro() diff --git a/Modules/Platform/QNX-QCC-C.cmake b/Modules/Platform/QNX-QCC-C.cmake deleted file mode 100644 index e5721a7..0000000 --- a/Modules/Platform/QNX-QCC-C.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -include(Platform/QNX) - -__compiler_qcc(C) diff --git a/Modules/Platform/QNX-QCC-CXX.cmake b/Modules/Platform/QNX-QCC-CXX.cmake deleted file mode 100644 index e490bbe..0000000 --- a/Modules/Platform/QNX-QCC-CXX.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -include(Platform/QNX) - -__compiler_qcc(CXX) diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index cc551bd..ebc4609 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -1,5 +1,8 @@ set(QNXNTO 1) +include(Platform/GNU) +unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX) + set(CMAKE_DL_LIBS "") # Shared libraries with no builtin soname may not be linked safely by @@ -14,22 +17,3 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") endforeach() - -include(Platform/GNU) -unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX) - -macro(__compiler_qcc lang) - # http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples - set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V") - - set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,") - set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,,-MT,,-MF,") - - if (lang STREQUAL CXX) - # If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the - # default for the driver is not c++. - set(CMAKE_CXX_COMPILE_OBJECT - " -lang-c++ -o -c ") - endif() - -endmacro() -- cgit v0.12