-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
59 lines (41 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
53
54
55
56
57
58
59
cmake_minimum_required(VERSION 3.2)
project(bwapi-c VERSION 1.0.0)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
set(CMAKE_CXX_STANDARD 11) # C++11...
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_COMPILER_IS_CLANGXX 1)
endif()
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror")
endif()
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) # To automatically create compatible .lib from .dll
if (NOT BWAPI_PATH)
message(FATAL_ERROR "You must set BWAPI_PATH install path")
endif()
find_package(BWAPI REQUIRED)
# BWAPIC
file(GLOB_RECURSE BWAPIC_SRC "${CMAKE_SOURCE_DIR}/src/*.cpp")
add_library(BWAPIC SHARED ${BWAPIC_SRC})
target_include_directories(BWAPIC SYSTEM PUBLIC include/ ${BWAPI_INCLUDE_DIRS})
target_link_libraries(BWAPIC PRIVATE BWAPI BWAPIClient)
set_property(TARGET BWAPIC PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
# Examples
add_library(ExampleDll MODULE example/Dll.c)
target_link_libraries(ExampleDll BWAPIC)
add_executable(ExampleClient example/Client.c)
target_link_libraries(ExampleClient BWAPIC)
# Installation
install(DIRECTORY include/ DESTINATION include)
install(TARGETS BWAPIC DESTINATION lib)
if (UNIX)
install(FILES ${BWAPI_DLL} DESTINATION lib)
else()
install(FILES ${BWAPI_DLL_DEBUG} DESTINATION lib CONFIGURATIONS Debug)
install(FILES ${BWAPI_DLL_RELEASE} DESTINATION lib CONFIGURATIONS Release RelWithDebInfo MinSizeRel)
endif(UNIX)
# Package
set(CPACK_GENERATOR "ZIP")
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
include(CPack)