-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
42 lines (32 loc) · 1.16 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
cmake_minimum_required(VERSION 3.10)
project(dynafen VERSION 1.0.0.0)
include(GNUInstallDirs)
set(dynafen_src "src/DynafenBase.cpp" "src/DynafenCore.cpp" "src/DynafenHandle.cpp")
if(LINUX)
list(APPEND dynafen_src "src/DynafenCore.Linux.cpp")
elseif(WIN32)
list(APPEND dynafen_src "src/DynafenCore.Win32.cpp")
endif()
add_library(dynafen STATIC ${dynafen_src})
target_include_directories(dynafen PUBLIC "include")
if(LINUX)
target_link_directories(dynafen PRIVATE dl)
elseif(WIN32)
target_link_directories(dynafen PRIVATE kernel32)
endif()
option(BUILD_TEST "Build test apps" ON)
if(BUILD_TEST)
add_executable(testbin "test/test_compile.cpp")
add_library(testlib SHARED "test/test_lib.cpp")
target_link_libraries(testbin PRIVATE dynafen)
add_test(NAME "Dynafen Main Test" COMMAND $<TARGET_FILE:testbin>)
endif()
install(DIRECTORY include DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/.."
FILES_MATCHING PATTERN dynafen.hxx)
install(TARGETS dynafen
EXPORT dynafenTargets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(Pack)