-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
executable file
·45 lines (37 loc) · 1.35 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
# Set required version and policy version
cmake_minimum_required( VERSION 3.9.2 FATAL_ERROR )
cmake_policy( VERSION 3.9.2...3.17 )
# Prohibit screwing up the source tree
set( CMAKE_DISABLE_IN_SOURCE_BUILD ON )
set( CMAKE_DISABLE_SOURCE_CHANGES ON )
# Use C++17 everywhere
set( CMAKE_CXX_STANDARD 20 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
# Name the project and set a prefix for naming internal targets and variables
project( discord VERSION 0.01.01.01 LANGUAGES CXX C )
set( TARGET_PREFIX ${PROJECT_NAME} )
# Attempt support for cross-compile builds for windows
if( CROSS_COMPILE_FOR_WINDOWS )
message( "Cross Compiling for Windows with MinGW 64-bit" )
set( CMAKE_SYSTEM_NAME Windows )
set( CMAKE_C_COMPILER x86_64-w64-mingw32-gcc )
set( CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++ )
set( CMAKE_RC_COMPILER x86_64-w64-mingw32-windres )
set( CMAKE_RANLIB x86_64-w64-mingw32-ranlib )
set( FOR_WINDOWS TRUE )
set( LIB_NAME ${TARGET_PREFIX}.dll )
elseif( WIN32 )
set( FOR_WINDOWS TRUE )
set( LIB_NAME ${TARGET_PREFIX} )
else()
set( LIB_NAME ${TARGET_PREFIX} )
endif()
# Use target folders to organize target list
set_property( GLOBAL PROPERTY USE_FOLDERS ON )
# Build shared libs
add_subdirectory( source )
# Optionally build the example(s)
option( DISCORD_BUILD_EXAMPLES "Build Examples" ON )
if ( DISCORD_BUILD_EXAMPLES )
add_subdirectory( example )
endif()