Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function(PUSH_INCLUDE path)
set(GLOBAL_INCLUDES ${GLOBAL_INCLUDES} ${path})
list(REMOVE_DUPLICATES GLOBAL_INCLUDES)
set(GLOBAL_INCLUDES ${GLOBAL_INCLUDES} CACHE INTERNAL "GLOBAL_INCLUDES")
endfunction(PUSH_INCLUDE)
macro(BUILD_APPS project)
if(BUILD_APPS)
set (libs ${ARGN})
file(GLOB apps_sources ${CMAKE_CURRENT_SOURCE_DIR}/apps/*.cpp)
foreach(file ${apps_sources})
get_filename_component(name ${file} NAME_WE)
add_executable(${name} ${file})
target_link_libraries(${name} ${project} ${libs})
endforeach()
endif()
endmacro()
macro(DECLARE_MODULE name type)
set (libs ${ARGN})
project(${name})
set(project_include_dir ${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${project_include_dir})
include_directories(${GLOBAL_INCLUDES})
file(GLOB_RECURSE SOURCES sources/*.cpp)
add_library(${PROJECT_NAME} ${type} ${SOURCES})
PUSH_INCLUDE(${project_include_dir})
target_link_libraries(${PROJECT_NAME} ${libs})
BUILD_APPS(${name} ${libs})
endmacro()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.