PokemonScriptTester/CMakeLists.txt

41 lines
1.2 KiB
CMake
Raw Normal View History

2021-08-29 09:42:50 +00:00
cmake_minimum_required(VERSION 3.18)
2021-08-22 17:03:03 +00:00
project(PokemonScriptTester)
set(CMAKE_CXX_STANDARD 20)
2021-08-29 14:10:14 +00:00
set(BUILD_SHARED_LIBS OFF)
2021-08-22 17:03:03 +00:00
option(WINDOWS "Whether the build target is Windows or not." OFF)
2021-08-29 14:10:14 +00:00
set(SHARED OFF)
2021-08-22 17:03:03 +00:00
include(CMakeLists.txt.in)
include_pkmnlib()
2021-08-29 10:42:59 +00:00
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-fconcepts)
endif ()
2021-08-29 14:10:14 +00:00
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_link_options(-fuse-ld=lld)
endif ()
2021-08-22 17:03:03 +00:00
file(GLOB_RECURSE SRC_FILES src/*.cpp src/*.hpp)
add_executable(PokemonScriptTester ${SRC_FILES})
target_precompile_headers(PokemonScriptTester PUBLIC src/Precompiled.hxx)
add_definitions(-DLEVEL_U8)
2021-08-29 14:10:14 +00:00
SET(_LINKS -static pkmnLib)
2021-08-22 17:03:03 +00:00
target_link_libraries(PokemonScriptTester PUBLIC ${_LINKS})
target_compile_options(PokemonScriptTester PRIVATE -Wall -Wextra -Werror)
2021-08-29 10:14:27 +00:00
if (WINDOWS)
MESSAGE(WARNING, "Using Windows Build.")
# Add a definition for the compiler, so we can use it in C++ as well.
ADD_DEFINITIONS(-D WINDOWS=1)
# -m64: Build a 64 bit library
add_compile_options(-m64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-allow-multiple-definition")
if (SHARED)
set_target_properties(PokemonScriptTester PROPERTIES SUFFIX ".exe")
2021-08-29 10:14:27 +00:00
endif(SHARED)
endif (WINDOWS)