Created
October 12, 2016 09:34
-
-
Save donkaban/c453aa49be8991e009f24610410fb3ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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