PokemonScriptTester/CMakeLists.txt

44 lines
1.3 KiB
CMake

cmake_minimum_required(VERSION 3.18)
project(PokemonScriptTester)
set(CMAKE_CXX_STANDARD 20)
set(BUILD_SHARED_LIBS OFF)
option(WINDOWS "Whether the build target is Windows or not." OFF)
set(SHARED OFF)
include(CMakeLists.txt.in)
include_pkmnlib()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-fconcepts)
endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_link_options(-fuse-ld=lld)
endif ()
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)
SET(_LINKS -static pkmnLib)
target_link_libraries(PokemonScriptTester PUBLIC ${_LINKS})
target_compile_options(PokemonScriptTester PRIVATE -Wall -Wextra -Werror)
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")
endif(SHARED)
endif (WINDOWS)
INCLUDE(extern/gitversion/cmake.cmake)
TARGET_GIT_VERSION_INIT(PokemonScriptTester)