-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathCMakeLists.txt
48 lines (42 loc) · 1.47 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
cmake_minimum_required(VERSION 3.16)
project(mdk-examples VERSION 0.0.0)
if(POLICY CMP0063) # visibility. since 3.3
cmake_policy(SET CMP0063 NEW)
endif()
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(EXTRA_LIB_DIRS_FLAG)
link_libraries(${EXTRA_LIB_DIRS_FLAG})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${EXTRA_LIB_DIRS_FLAG})
endif()
include_directories(${EXTRA_INCLUDE})
#link_directories(${EXTRA_LIB_DIRS_FLAG}) # why will append -L.../examples and become invalid -L..../examples-L....external...?
foreach(LFLAG ${EXTRA_LIB_DIRS_FLAG})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FLAG}")
endforeach()
#list(APPEND CMAKE_REQUIRED_INCLUDES ${EXTRA_INCLUDE})
#list(APPEND CMAKE_REQUIRED_LIBRARIES ${EXTRA_LIB_DIRS_FLAG})
if(WIN32)
set(APPTYPE WIN32) # /subsystem:windows
endif()
if(MSVC)# AND NOT CMAKE_CXX_SIMULATE_ID MATCHES MSVC) # link.exe, lld>=8.0
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -entry:mainCRTStartup")
endif()
include(CheckLibraryExists)
if(NOT BUILD_MDK)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/mdk-sdk/lib/cmake)
#find_package(mdk REQUIRED)
include(${CMAKE_SOURCE_DIR}/mdk-sdk/lib/cmake/FindMDK.cmake)
endif()
message("MDK_LIBRARIES:${MDK_LIBRARIES}")
if(TARGET cppcompat) # requires https://github.com/wang-bin/cppcompat
link_libraries(cppcompat)
endif()
if(NOT CMAKE_MACOSX_BUNDLE)
add_subdirectory(GLFW)
add_subdirectory(Native)
add_subdirectory(SDL)
if(APPLE)
add_subdirectory(macOS)
endif()
endif()