-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
54 lines (42 loc) · 1.46 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
cmake_minimum_required(VERSION 3.13)
project(lemonc VERSION 1.0.0)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
file(GLOB_RECURSE sources src/main/*.cpp src/main/*.h)
file(GLOB_RECURSE sources_test src/test/*.cpp)
find_path(LEMON_SOURCE_ROOT_DIR CMakeLists.txt
PATHS ${CMAKE_SOURCE_DIR}/lemon
NO_DEFAULT_PATH
DOC "Location of LEMON source as a CMAKE subproject")
if(EXISTS ${LEMON_SOURCE_ROOT_DIR})
add_subdirectory(${LEMON_SOURCE_ROOT_DIR} deps/lemon)
set(LEMON_INCLUDE_DIRS
${LEMON_SOURCE_ROOT_DIR}
${CMAKE_BINARY_DIR}/deps/lemon
)
set(LEMON_LIBRARIES lemon)
unset(LEMON_ROOT_DIR CACHE)
unset(LEMON_DIR CACHE)
unset(LEMON_INCLUDE_DIR CACHE)
unset(LEMON_LIBRARY CACHE)
else()
message(FATAL_ERROR "Lemon not found!")
endif()
include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_BINARY_DIR}
${LEMON_INCLUDE_DIRS}
)
add_library(lemonc SHARED ${sources})
target_compile_options(lemonc PUBLIC -std=c++14 -Wall)
if (WIN32)
message("WINDOWS")
target_link_options(lemonc PUBLIC -m64 -Wl,-allow-multiple-definition)
target_link_libraries(lemonc PUBLIC ${LEMON_LIBRARIES} -static gcc stdc++ winpthread -dynamic)
else()
message("MAC/LINUX")
target_link_options(lemonc PUBLIC -m64)
target_link_libraries(lemonc PUBLIC ${LEMON_LIBRARIES})
endif()
add_executable(lemonc-test src/main/types.h ${sources_test})
target_compile_options(lemonc-test PUBLIC -std=c++14 -Wall)
target_link_libraries(lemonc-test PUBLIC lemonc)