-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
53 lines (43 loc) · 1.68 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Copyright (C) 2015 JdeRobot-ng
# Authors:
# 2015 Dec, Victor Arribas <[email protected]>
project (jderobot-sandbox)
cmake_minimum_required(VERSION 2.8)
## Tools
include(cmake/Tools/check_compiler.cmake)
include(cmake/Tools/find_packages.cmake)
include(cmake/Tools/declare_package.cmake)
include(cmake/Tools/use_package.cmake)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Tools/CMake")
## Dependencies
# allow Deps to populate
# * include_directories
# * link_directories
# for JdeRobot libraries
set(INJECT_JDE_LIBS ON)
# for 3rd party libraries
set(INJECT_DEPS_LIBS OFF)
# alphabetical sorted to handle dependency order
# this means that you must to prepend letter based sort at directory level
file(GLOB_RECURSE CMakeLists_files "cmake/Deps/**/CMakeLists.txt")
list(SORT CMakeLists_files)
foreach(CMakeLists_file ${CMakeLists_files})
message(STATUS "${CMakeLists_file}")
include(${CMakeLists_file})
endforeach()
## Code (user code)
# alphabetical sorted to handle dependency order
file(GLOB_RECURSE CMakeLists_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/**/CMakeLists.txt")
list(SORT CMakeLists_files)
if (CMakeLists_files)
string(REGEX REPLACE "//" "/" list ${CMakeLists_files})
string(REGEX REPLACE "/CMakeLists.txt" "" list ${list})
string(REGEX REPLACE "src/" "\n\t- " list ${list})
message(STATUS "Found following components to build: ${list}\n")
foreach(CMakeLists_file ${CMakeLists_files})
get_filename_component(CMakeLists_dir ${CMakeLists_file} PATH)
string(REGEX REPLACE "src/" "" name ${CMakeLists_dir})
message(STATUS "Configuring '${name}'")
add_subdirectory(${CMakeLists_dir})
endforeach()
endif()