Arbutils/CMakeLists.txt

45 lines
1.2 KiB
CMake

cmake_minimum_required(VERSION 3.13)
project(Arbutils)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
set(CMAKE_CXX_STANDARD 17)
if (WINDOWS)
ADD_DEFINITIONS(-D WINDOWS=1)
endif (WINDOWS)
file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp")
set(LIBTYPE STATIC)
if (SHARED)
set(LIBTYPE SHARED)
endif(SHARED)
add_library(Arbutils ${LIBTYPE} ${SRC_FILES})
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
if (NOT DEFINED CONAN_EXPORTED)
add_executable(ArbutilsTests ${TEST_FILES} extern/catch.hpp)
target_link_libraries(ArbutilsTests Arbutils)
endif()
if (WINDOWS)
MESSAGE(WARNING, "Using Windows Build.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -Wl,-allow-multiple-definition")
endif (WINDOWS)
if (STATICC)
target_link_libraries(Arbutils -static-libgcc -static-libstdc++)
if (NOT DEFINED CONAN_EXPORTED)
target_link_libraries(ArbutilsTests -static-libgcc -static-libstdc++)
endif()
endif(STATICC)
if (NOT DEFINED CONAN_EXPORTED)
target_compile_definitions(ArbutilsTests PRIVATE TESTS_BUILD)
endif()
if (NOT WINDOWS)
install(TARGETS Arbutils
CONFIGURATIONS Release
RUNTIME DESTINATION lib)
endif()