cmake_minimum_required(VERSION 3.20) project(SLeeLaNativeCompiler VERSION 0.1.0 LANGUAGES CXX) include(GNUInstallDirs) option(SLEELA_COMPILER_BUILD_TESTS "Build native compiler tests" ON) add_library(sleela_compiler_core src/compiler.cpp) target_include_directories(sleela_compiler_core PUBLIC include) target_compile_features(sleela_compiler_core PUBLIC cxx_std_20) if(MSVC) target_compile_options(sleela_compiler_core PRIVATE /W4) else() target_compile_options(sleela_compiler_core PRIVATE -Wall -Wextra -Wpedantic) endif() add_executable(sleelac src/main.cpp) target_link_libraries(sleelac PRIVATE sleela_compiler_core) if(SLEELA_COMPILER_BUILD_TESTS) enable_testing() add_executable(sleela_compiler_tests tests/compiler_tests.cpp) target_link_libraries(sleela_compiler_tests PRIVATE sleela_compiler_core) add_test(NAME sleela_compiler_tests COMMAND sleela_compiler_tests) endif() install(TARGETS sleela_compiler_core sleelac ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})