Arbutils/CMakeLists.txt

24 lines
847 B
CMake

cmake_minimum_required(VERSION 3.16)
project(Arbutils)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
set(CMAKE_CXX_STANDARD 17)
file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp")
add_library(Arbutils SHARED ${SRC_FILES})
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
add_executable(ArbutilsTests ${TEST_FILES} extern/catch.hpp)
target_link_libraries(ArbutilsTests Arbutils)
if (WINDOWS)
MESSAGE(WARNING, "Using Windows Build.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -Wl,-allow-multiple-definition")
# Statically link libraries we need in Windows.
target_link_libraries(Arbutils -static -static-libgcc -static-libstdc++)
target_link_libraries(ArbutilsTests -static -static-libgcc -static-libstdc++)
endif (WINDOWS)
target_compile_definitions(ArbutilsTests PRIVATE TESTS_BUILD)