MalachScript/CMakeLists.txt

35 lines
987 B
CMake

cmake_minimum_required(VERSION 3.17)
project(ElohimScript)
# Enable all warnings, and make them error when occurring.
add_compile_options(-Wall -Wextra -Werror)
# We like new stuff, so set the c++ standard to c++20.
set(CMAKE_CXX_STANDARD 20)
option(TESTS "Whether the test executable should be build as well." OFF)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_link_options(-fuse-ld=lld)
endif ()
if (NOT WINDOWS)
# Include debug symbols in all linux builds
add_compile_options(-g -gfull -g3)
endif ()
file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp")
add_library(ElohimScript SHARED ${SRC_FILES})
if (TESTS)
# Create Test executable
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
add_executable(ElohimScriptTests ${TEST_FILES} extern/doctest.hpp)
target_link_libraries(ElohimScriptTests PUBLIC ElohimScript)
# Add a definition for the test library
target_compile_definitions(ElohimScriptTests PRIVATE TESTS_BUILD)
endif ()