2020-02-26 12:02:02 +00:00
|
|
|
cmake_minimum_required(VERSION 3.13)
|
2020-02-26 11:57:18 +00:00
|
|
|
project(Arbutils)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
|
2020-06-26 13:56:00 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
2020-02-26 11:57:18 +00:00
|
|
|
|
2020-05-02 13:30:25 +00:00
|
|
|
if (WINDOWS)
|
|
|
|
ADD_DEFINITIONS(-D WINDOWS=1)
|
|
|
|
endif (WINDOWS)
|
|
|
|
|
2020-02-26 11:57:18 +00:00
|
|
|
file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp")
|
2020-05-02 13:30:25 +00:00
|
|
|
set(LIBTYPE STATIC)
|
2020-05-02 10:31:04 +00:00
|
|
|
if (SHARED)
|
2020-06-26 13:56:00 +00:00
|
|
|
set(LIBTYPE SHARED src/StringView.hpp src/String/BasicStringView.hpp src/String/StringViewLiteral.hpp)
|
2020-05-02 10:31:04 +00:00
|
|
|
endif(SHARED)
|
2020-05-02 13:30:25 +00:00
|
|
|
add_library(Arbutils ${LIBTYPE} ${SRC_FILES})
|
2020-02-26 11:57:18 +00:00
|
|
|
|
2020-02-27 16:24:46 +00:00
|
|
|
|
2020-02-26 11:57:18 +00:00
|
|
|
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
|
2020-02-26 12:38:18 +00:00
|
|
|
if (NOT DEFINED CONAN_EXPORTED)
|
|
|
|
add_executable(ArbutilsTests ${TEST_FILES} extern/catch.hpp)
|
|
|
|
target_link_libraries(ArbutilsTests Arbutils)
|
|
|
|
endif()
|
2020-02-26 11:57:18 +00:00
|
|
|
|
|
|
|
if (WINDOWS)
|
|
|
|
MESSAGE(WARNING, "Using Windows Build.")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -Wl,-allow-multiple-definition")
|
2020-05-03 10:27:22 +00:00
|
|
|
endif (WINDOWS)
|
|
|
|
|
|
|
|
if (STATICC)
|
2020-05-03 10:35:17 +00:00
|
|
|
target_link_libraries(Arbutils -static-libgcc -static-libstdc++)
|
2020-02-26 12:38:18 +00:00
|
|
|
if (NOT DEFINED CONAN_EXPORTED)
|
2020-05-03 10:35:17 +00:00
|
|
|
target_link_libraries(ArbutilsTests -static-libgcc -static-libstdc++)
|
2020-02-26 12:38:18 +00:00
|
|
|
endif()
|
2020-05-03 10:27:22 +00:00
|
|
|
endif(STATICC)
|
2020-02-26 11:57:18 +00:00
|
|
|
|
2020-02-26 12:38:18 +00:00
|
|
|
if (NOT DEFINED CONAN_EXPORTED)
|
|
|
|
target_compile_definitions(ArbutilsTests PRIVATE TESTS_BUILD)
|
|
|
|
endif()
|
2020-03-11 10:38:36 +00:00
|
|
|
|
2020-03-11 10:50:56 +00:00
|
|
|
if (NOT WINDOWS)
|
|
|
|
install(TARGETS Arbutils
|
|
|
|
CONFIGURATIONS Release
|
|
|
|
RUNTIME DESTINATION lib)
|
|
|
|
endif()
|