[CONSRV]
[reactos.git] / cmake / compilerflags.cmake
index bad4179..1b3ad21 100644 (file)
@@ -36,6 +36,7 @@ endfunction()
 #  add_target_compile_flags(mymodule "-pedantic -O5")
 #  add_target_compile_definitions(mymodule WIN32 _WIN32 INLINE=inline)
 #  add_target_include_directories(mymodule include ../include)
+#  add_compile_flags_language("-std=gnu99" "C")
 function(add_compile_flags _flags)
     if(${ARGC} GREATER 1)
         message(STATUS "Excess arguments to add_compile_flags! Args ${ARGN}")
@@ -46,6 +47,14 @@ function(add_compile_flags _flags)
     set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${_flags}" PARENT_SCOPE)
 endfunction()
 
+function(add_compile_flags_language _flags _lang)
+    if(NOT ${ARGC} EQUAL 2)
+        message(STATUS "Wrong arguments to add_compile_flags_language! Args ${ARGN}")
+    endif()
+    # Adds the compiler flag to both CMAKE_C_FLAGS and CMAKE_CXX_FLAGS
+    set(CMAKE_${_lang}_FLAGS "${CMAKE_${_lang}_FLAGS} ${_flags}" PARENT_SCOPE)
+endfunction()
+
 function(add_target_compile_flags _module _flags)
     if(${ARGC} GREATER 2)
         message(STATUS "Excess arguments to add_target_compile_flags! Module ${_module}, args ${ARGN}")