[evolution-ews] Do not require C++ compiler, when not used



commit a69ab0f77dd15af8e9d9b55dc3d713aadd560ae9
Author: Milan Crha <mcrha redhat com>
Date:   Thu Nov 10 15:50:18 2016 +0100

    Do not require C++ compiler, when not used

 CMakeLists.txt                      |    2 +-
 cmake/modules/SetupBuildFlags.cmake |   21 +++++++++++++--------
 2 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f2f9452..519f867 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +5,7 @@ cmake_policy(VERSION 3.0)
 
 project(evolution-ews
        VERSION 3.23.2
-       LANGUAGES C CXX)
+       LANGUAGES C)
 set(PROJECT_BUGREPORT "http://bugzilla.gnome.org/enter_bug.cgi?product=evolution-ews";)
 
 # Required for FindIntltool module
diff --git a/cmake/modules/SetupBuildFlags.cmake b/cmake/modules/SetupBuildFlags.cmake
index a7d2aa4..3221591 100644
--- a/cmake/modules/SetupBuildFlags.cmake
+++ b/cmake/modules/SetupBuildFlags.cmake
@@ -3,7 +3,10 @@
 # Setups compiler/linker flags, skipping those which are not supported.
 
 include(CheckCCompilerFlag)
-include(CheckCXXCompilerFlag)
+
+if(CMAKE_CXX_COMPILER_ID)
+       include(CheckCXXCompilerFlag)
+endif(CMAKE_CXX_COMPILER_ID)
 
 macro(setup_build_flags _maintainer_mode)
        list(APPEND proposed_flags
@@ -64,13 +67,15 @@ macro(setup_build_flags _maintainer_mode)
                unset(c_flag_${flag}_supported)
        endforeach()
 
-       foreach(flag IN LISTS proposed_cxx_flags)
-               check_cxx_compiler_flag(${flag} cxx_flag_${flag}_supported)
-               if(cxx_flag_${flag}_supported)
-                       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
-               endif(cxx_flag_${flag}_supported)
-               unset(cxx_flag_${flag}_supported)
-       endforeach()
+       if(CMAKE_CXX_COMPILER_ID)
+               foreach(flag IN LISTS proposed_cxx_flags)
+                       check_cxx_compiler_flag(${flag} cxx_flag_${flag}_supported)
+                       if(cxx_flag_${flag}_supported)
+                               set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+                       endif(cxx_flag_${flag}_supported)
+                       unset(cxx_flag_${flag}_supported)
+               endforeach()
+       endif(CMAKE_CXX_COMPILER_ID)
 
        if(("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU"))
                set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined")


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]