PorygonLang/CMakeLists.txt

41 lines
1.1 KiB
CMake
Executable File

cmake_minimum_required(VERSION 3.10)
if (NOT CMAKE_C_COMPILER)
if (GCC)
set(CMAKE_C_COMPILER "gcc")
set(CMAKE_CXX_COMPILER "g++")
else()
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
endif(GCC)
endif(NOT CMAKE_C_COMPILER)
project(PorygonLang)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include_directories(extern)
if (WINDOWS)
ADD_DEFINITIONS(-D WINDOWS=1)
endif(WINDOWS)
file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp")
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
add_library(PorygonLang SHARED ${SRC_FILES})
add_executable(PorygonLangTests
${SRC_FILES}
${TEST_FILES})
target_link_libraries(PorygonLang -static-libgcc -static-libstdc++)
target_link_libraries(PorygonLangTests -static-libgcc -static-libstdc++)
if (WINDOWS)
target_link_libraries(PorygonLang -static -static-libgcc -static-libstdc++)
target_link_libraries(PorygonLangTests -static -static-libgcc -static-libstdc++)
endif(WINDOWS)
target_compile_definitions(PorygonLangTests PRIVATE TESTS_BUILD)