aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorChristian Fetzer <fetzer.ch@gmail.com>2016-07-22 14:27:24 +0200
committerChristian Fetzer <fetzer.ch@gmail.com>2016-07-27 23:17:34 +0200
commitbbfd454af1d2c2df932763727358bfa68010b7b8 (patch)
tree28ab4e4cb82ee8c53be97f4ffc30f2cfa67411ff /project
parent09288325769cf224887ec2144e9fc84f7d969a12 (diff)
[cmake/win32] Use C++ compiler to compile .c files
Move setting the LANGUAGE source file properties into a function. This is in preparation to optionally build static libraries. This property can only be specified in the CMakeLists.txt that generates the target. Later in the non static lib case, it will be called in the main executable/library.
Diffstat (limited to 'project')
-rw-r--r--project/cmake/scripts/common/Macros.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/project/cmake/scripts/common/Macros.cmake b/project/cmake/scripts/common/Macros.cmake
index 921271ee22..bc4556e1be 100644
--- a/project/cmake/scripts/common/Macros.cmake
+++ b/project/cmake/scripts/common/Macros.cmake
@@ -75,6 +75,7 @@ function(core_add_library name)
if(CORE_SYSTEM_NAME STREQUAL windows AND CMAKE_CURRENT_LIST_DIR MATCHES "^${CORE_SOURCE_DIR}/xbmc")
add_precompiled_header(${name} pch.h ${CORE_SOURCE_DIR}/xbmc/platform/win32/pch.cpp
PCH_TARGET kodi)
+ set_language_cxx(${name})
endif()
# IDE support
@@ -176,6 +177,19 @@ function(core_add_shared_library name)
endif()
endfunction()
+# Sets the compile language for all C source files in a target to CXX.
+# Needs to be called from the CMakeLists.txt that defines the target.
+# Arguments:
+# target target
+function(set_language_cxx target)
+ get_property(sources TARGET ${target} PROPERTY SOURCES)
+ foreach(file IN LISTS sources)
+ if(file MATCHES "\.c$")
+ set_source_files_properties(${file} PROPERTIES LANGUAGE CXX)
+ endif()
+ endforeach()
+endfunction()
+
# Add a data file to installation list with a mirror in build tree
# Arguments:
# file full path to file to mirror