This repository has been archived by the owner on Nov 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathCMakeLists.txt
72 lines (59 loc) · 2.49 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 17)
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{CMAKE_TOOLCHAIN_FILE})
set(CMAKE_TOOLCHAIN_FILE $ENV{CMAKE_TOOLCHAIN_FILE})
endif()
macro(add_subdirectories dir bin)
set(curdir ${CMAKE_CURRENT_LIST_DIR}/${dir})
file(GLOB children RELATIVE ${curdir} ${curdir}/*)
foreach(child ${children})
if(IS_DIRECTORY ${curdir}/${child})
if(EXISTS ${curdir}/${child}/CMakeLists.txt)
add_subdirectory(${curdir}/${child} ${bin}/${dir}/${child})
endif()
if(EXISTS ${curdir}/${child}/src/CMakeLists.txt)
add_subdirectory(${curdir}/${child}/src ${bin}/${dir}/${child})
endif()
endif()
endforeach()
endmacro()
function(add_sources dir srcs)
set(curdir ${CMAKE_CURRENT_LIST_DIR}/${dir})
file(GLOB children RELATIVE ${curdir} ${curdir}/*)
foreach(child ${children})
if(IS_DIRECTORY ${curdir}/${child})
if (dir STREQUAL ".")
add_sources(${child} ${srcs})
else()
add_sources(${dir}/${child} ${srcs})
endif()
endif()
endforeach()
file(GLOB HDRS_LOCAL RELATIVE ${CMAKE_CURRENT_LIST_DIR} ${curdir}/*.h)
file(GLOB TMPL_LOCAL RELATIVE ${CMAKE_CURRENT_LIST_DIR} ${curdir}/*.hpp)
file(GLOB SRCS_LOCAL RELATIVE ${CMAKE_CURRENT_LIST_DIR} ${curdir}/*.cpp)
file(GLOB SRCS_LOCAL RELATIVE ${CMAKE_CURRENT_LIST_DIR} ${SRCS_LOCAL} ${curdir}/*.c)
set(SRCS_LOCAL_ALL ${HDRS_LOCAL} ${TMPL_LOCAL} ${SRCS_LOCAL})
set(${srcs} ${${srcs}} ${SRCS_LOCAL_ALL} PARENT_SCOPE)
if (NOT dir STREQUAL ".")
string(REPLACE "/" "\\\\" src_grp ${dir})
source_group(${src_grp} FILES ${SRCS_LOCAL_ALL})
endif()
endfunction()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
project(opensemba CXX)
add_definitions(-DOPENSEMBA_VERSION="0.15")
add_subdirectory(external/gidpost/ obj/external/gidpost/)
include_directories(src/ src/core/)
add_subdirectory (src/core obj/src/core)
add_subdirectory (src/parsers obj/src/parsers)
add_subdirectory (src/exporters obj/src/exporters)
message(STATUS "Creating build system for opensemba with the following options:")
option(OPENSEMBA_TESTS OFF)
message(STATUS "OPEMSEMBA_TESTS: " ${OPENSEMBA_TESTS})
if(OPENSEMBA_TESTS)
enable_testing()
add_subdirectory(test/ obj/test/)
endif()