summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-09-24 23:38:50 +0100
committeriphydf <iphydf@users.noreply.github.com>2016-09-26 00:03:48 +0100
commit621c3fddb289de948c3cf48c5e1625e0f5b11a9d (patch)
tree7410930e5a8b513f055b013639619627319e96cb /cmake
parentd369448ace7ab9b77b6f0e644fdb42ff8dc9a31d (diff)
C++ the second round.
Group chats were changed and now need to be updated. This change got lost in the merge.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/ModulePackage.cmake16
1 files changed, 11 insertions, 5 deletions
diff --git a/cmake/ModulePackage.cmake b/cmake/ModulePackage.cmake
index b963e0de..fa3779c3 100644
--- a/cmake/ModulePackage.cmake
+++ b/cmake/ModulePackage.cmake
@@ -4,11 +4,19 @@ option(COMPILE_AS_CXX "Compile all C code as C++ code" OFF)
4 4
5find_package(PkgConfig REQUIRED) 5find_package(PkgConfig REQUIRED)
6 6
7function(add_c_executable exec) 7function(set_source_language)
8 if(COMPILE_AS_CXX) 8 if(COMPILE_AS_CXX)
9 set_source_files_properties(${ARGN} PROPERTIES LANGUAGE CXX) 9 foreach(srcfile ${ARGN})
10 get_filename_component(srcext ${srcfile} EXT)
11 if(${srcext} STREQUAL ".c")
12 set_source_files_properties(${srcfile} PROPERTIES LANGUAGE CXX)
13 endif()
14 endforeach()
10 endif() 15 endif()
16endfunction()
11 17
18function(add_c_executable exec)
19 set_source_language(${ARGN})
12 add_executable(${exec} ${ARGN}) 20 add_executable(${exec} ${ARGN})
13endfunction() 21endfunction()
14 22
@@ -22,9 +30,7 @@ function(pkg_use_module mod)
22endfunction() 30endfunction()
23 31
24function(add_module lib) 32function(add_module lib)
25 if(COMPILE_AS_CXX) 33 set_source_language(${ARGN})
26 set_source_files_properties(${ARGN} PROPERTIES LANGUAGE CXX)
27 endif()
28 34
29 if(ENABLE_SHARED) 35 if(ENABLE_SHARED)
30 add_library(${lib}_shared SHARED ${ARGN}) 36 add_library(${lib}_shared SHARED ${ARGN})