Author: jgardou
Date: Wed Aug 3 15:02:11 2011
New Revision: 53048
URL:
http://svn.reactos.org/svn/reactos?rev=53048&view=rev
Log:
[CMAKE]
- use functions instead of macros.
This avoids adding flags multiple times.
See the PARENT_SCOPE option of cmake's command "set" for details.
Modified:
trunk/reactos/cmake/compilerflags.cmake
Modified: trunk/reactos/cmake/compilerflags.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/compilerflags.cmake?…
==============================================================================
--- trunk/reactos/cmake/compilerflags.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/compilerflags.cmake [iso-8859-1] Wed Aug 3 15:02:11 2011
@@ -1,31 +1,22 @@
-macro(add_compiler_flags)
+function(add_compiler_flags)
# Adds the compiler flag to both CMAKE_C_FLAGS and CMAKE_CXX_FLAGS
foreach(flag ${ARGN})
set(flags_list "${flags_list} ${flag}")
endforeach()
- if(CMAKE_C_FLAGS)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flags_list}")
- else()
- set(CMAKE_C_FLAGS ${flags_list})
- endif()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flags_list}" PARENT_SCOPE)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flags_list}" PARENT_SCOPE)
+endfunction()
- if(CMAKE_CXX_FLAGS)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flags_list}")
- else()
- set(CMAKE_CXX_FLAGS ${flags_list})
- endif()
-endmacro()
-
-macro(add_linkerflag MODULE _flag)
+function(add_linkerflag MODULE _flag)
set(NEW_LINKER_FLAGS ${_flag})
get_target_property(LINKER_FLAGS ${MODULE} LINK_FLAGS)
if(LINKER_FLAGS)
set(NEW_LINKER_FLAGS "${LINKER_FLAGS} ${NEW_LINKER_FLAGS}")
endif()
set_target_properties(${MODULE} PROPERTIES LINK_FLAGS ${NEW_LINKER_FLAGS})
-endmacro()
+endfunction()
macro(set_unicode)
add_definitions(-DUNICODE -D_UNICODE)