|
@@ -61,6 +61,32 @@ macro(addDebugDef def)
|
|
|
set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG "${def}")
|
|
|
endmacro()
|
|
|
|
|
|
+# adds a required definition. Are processed on addExecutable or addStaticLib
|
|
|
+macro(addRequiredDefinition def)
|
|
|
+ #message(STATUS "${PROJECT_NAME} : add def : ${def}")
|
|
|
+ LIST( APPEND ${PROJECT_NAME}_required_definition ${def} )
|
|
|
+endmacro()
|
|
|
+# adds a required debug definition. Are processed on addExecutable or addStaticLib
|
|
|
+macro(addRequiredDebugDefinition def)
|
|
|
+ #message(STATUS "${PROJECT_NAME} : add def : ${def}")
|
|
|
+ LIST( APPEND ${PROJECT_NAME}_required_debug_definition ${def} )
|
|
|
+endmacro()
|
|
|
+
|
|
|
+# add definitions to project
|
|
|
+macro( _processProjectDefinition )
|
|
|
+ foreach( def ${${PROJECT_NAME}_required_definition} )
|
|
|
+ addDef( ${def} )
|
|
|
+ endforeach()
|
|
|
+
|
|
|
+ foreach( def ${${PROJECT_NAME}_required_debug_definition} )
|
|
|
+ addDebugDef( ${def} )
|
|
|
+ endforeach()
|
|
|
+
|
|
|
+ #clear required defs
|
|
|
+ set( ${PROJECT_NAME}_required_definition )
|
|
|
+ set( ${PROJECT_NAME}_required_debug_definition )
|
|
|
+endmacro()
|
|
|
+
|
|
|
# adds an include path
|
|
|
macro(addInclude incPath)
|
|
|
#message(STATUS "${PROJECT_NAME} : add include path : ${incPath}")
|
|
@@ -73,6 +99,53 @@ macro(addLib lib)
|
|
|
target_link_libraries(${PROJECT_NAME} "${lib}")
|
|
|
endmacro()
|
|
|
|
|
|
+# adds a library dependency. Are processed on addExecutable or addStaticLib
|
|
|
+macro(addRequiredLibrary lib)
|
|
|
+ #message(STATUS "${PROJECT_NAME} : add lib : ${lib}")
|
|
|
+ LIST( APPEND ${PROJECT_NAME}_required_library ${lib} )
|
|
|
+endmacro()
|
|
|
+
|
|
|
+# adds a link dependency. Are processed on addExecutable or addStaticLib
|
|
|
+macro(addRequiredLink lib)
|
|
|
+ #message(STATUS "${PROJECT_NAME} : add lib : ${lib}")
|
|
|
+ LIST( APPEND ${PROJECT_NAME}_required_link ${lib} )
|
|
|
+endmacro()
|
|
|
+
|
|
|
+macro( _processProjectLibrary )
|
|
|
+ # Append currect project to PROJECT_STACK
|
|
|
+ LIST( APPEND PROJECT_STACK "${PROJECT_NAME}" )
|
|
|
+
|
|
|
+ foreach( lib ${${PROJECT_NAME}_required_library} )
|
|
|
+ #message( "adding library dependency: ${lib}" )
|
|
|
+ include( ${lib} )
|
|
|
+ endforeach()
|
|
|
+
|
|
|
+ #clear required libraries
|
|
|
+ set( ${PROJECT_NAME}_required_library )
|
|
|
+
|
|
|
+ # pop currect project form PROJECT_STACK
|
|
|
+ LIST(REMOVE_AT PROJECT_STACK -1)
|
|
|
+
|
|
|
+ # get currect project form stack
|
|
|
+ if( PROJECT_STACK )
|
|
|
+ LIST(GET PROJECT_STACK -1 TEMP_PROJECT)
|
|
|
+ project( ${TEMP_PROJECT} )
|
|
|
+ endif()
|
|
|
+
|
|
|
+
|
|
|
+endmacro()
|
|
|
+
|
|
|
+macro( _processProjectLinks )
|
|
|
+ #message( "_processProjectLinks: ${PROJECT_NAME}" )
|
|
|
+ foreach( lib ${${PROJECT_NAME}_required_link} )
|
|
|
+ addLib( ${lib} )
|
|
|
+ endforeach()
|
|
|
+
|
|
|
+ #clear required libraries
|
|
|
+ set( ${PROJECT_NAME}_required_link )
|
|
|
+endmacro()
|
|
|
+
|
|
|
+
|
|
|
# adds a path to search for libs
|
|
|
macro(addLibPath dir)
|
|
|
link_directories(${dir})
|
|
@@ -146,6 +219,10 @@ macro(addStaticLib)
|
|
|
#foreach(dir ${${PROJECT_NAME}_paths})
|
|
|
addInclude("${firstDir}")
|
|
|
#endforeach()
|
|
|
+
|
|
|
+ _processProjectLinks()
|
|
|
+ _processProjectLibrary()
|
|
|
+ _processProjectDefinition()
|
|
|
endmacro()
|
|
|
|
|
|
# macro to add an executable
|
|
@@ -161,6 +238,10 @@ macro(addExecutable)
|
|
|
add_executable("${PROJECT_NAME}" WIN32 ${${PROJECT_NAME}_files})
|
|
|
# omg - only use the first folder ... otehrwise we get lots of header name collisions
|
|
|
addInclude("${firstDir}")
|
|
|
+
|
|
|
+ _processProjectLinks()
|
|
|
+ _processProjectLibrary()
|
|
|
+ _processProjectDefinition()
|
|
|
endmacro()
|
|
|
|
|
|
macro(setupVersionNumbers)
|