+# New versions, using add_target_property where appropriate.
+# Note that the functions for string properties take a single string
+# argument while those for list properties can take a variable number of
+# arguments, all of which will be added to the list
+#
+# Examples:
+# add_compile_flags("-pedantic -O5")
+# add_target_link_flags(mymodule "-s --fatal-warnings")
+# add_target_compile_flags(mymodule "-pedantic -O5")
+# add_target_compile_definitions(mymodule WIN32 _WIN32)
+# add_target_include_directories(mymodule include ../include)
+function(add_compile_flags _flags)
+ if (${ARGC} GREATER 1)
+ message(STATUS "Excess arguments to add_compile_flags! Args ${ARGN}")
+ endif()
+ # Adds the compiler flag to both CMAKE_C_FLAGS and CMAKE_CXX_FLAGS
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flags}" PARENT_SCOPE)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_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}")
+ endif()
+ add_target_property(${_module} COMPILE_FLAGS ${_flags})
+endfunction()
+
+function(add_target_link_flags _module _flags)
+ if (${ARGC} GREATER 2)
+ message(STATUS "Excess arguments to add_target_link_flags! Module ${_module}, args ${ARGN}")
+ endif()
+ add_target_property(${_module} LINK_FLAGS ${_flags})
+endfunction()
+
+function(add_target_compile_definitions _module)
+ add_target_property(${_module} COMPILE_DEFINITIONS ${ARGN})
+endfunction()
+
+function(add_target_include_directories _module)
+ add_target_property(${_module} INCLUDE_DIRECTORIES ${ARGN})
+endfunction()
+