-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
37 lines (28 loc) · 1.13 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
cmake_minimum_required(VERSION 3.5)
set(CMAKE_VERBOSE_MAKEFILE ON)
project(wdb)
set(WDB ${PROJECT_NAME})
# Set output directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Compile with -std=c++11
add_compile_options(-std=c++11)
# Inlucde header files
set(WDB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${WDB_INCLUDE_DIRS})
# Add wabt project
set(BUILD_TESTS OFF CACHE BOOL "Disable gtest in wabt" FORCE)
add_subdirectory(lib/wabt)
# Add wabt header files
set(WABT_INCLUDE_DIRS ${WABT_SOURCE_DIR}/../ ${WABT_BINARY_DIR}/../ ${WABT_SOURCE_DIR} ${WABT_BINARY_DIR})
include_directories(${WABT_INCLUDE_DIRS}) # Include <src/...> as required by wabt, but for clarity only also include <wabt/src/...>
# Expose include dirs for projects using wdb
get_directory_property(hasParent PARENT_DIRECTORY)
if(hasParent)
set(WDB_INCLUDE_DIRS ${WDB_INCLUDE_DIRS} ${WABT_INCLUDE_DIRS} PARENT_SCOPE)
endif()
# Generate executable
file(GLOB_RECURSE PROJECT_SOURCE_FILES src/*.cpp src/*/*.cpp)
# Add wabt dependency
add_library(${WDB} ${PROJECT_SOURCE_FILES})
# Link libraries to the
target_link_libraries(${WDB} wabt)