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



commit f6620a0e39c5e719c055bd51b39e15072c7b7a3d
Author: Milan Crha <mcrha redhat com>
Date:   Thu Nov 10 15:49:31 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 18383bb..9e3f953 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +5,7 @@ cmake_policy(VERSION 3.0)
 
 project(evolution
        VERSION 3.23.2
-       LANGUAGES C CXX)
+       LANGUAGES C)
 set(PROJECT_BUGREPORT "http://bugzilla.gnome.org/enter_bug.cgi?product=Evolution";)
 set(PROJECT_URL "http://wiki.gnome.org/Apps/Evolution/";)
 
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]