mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-06-11 02:36:33 +08:00
30 lines
1.5 KiB
CMake
30 lines
1.5 KiB
CMake
cmake_minimum_required(VERSION 3.2)
|
|
project(ghcfilesystem)
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
|
|
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
|
|
|
add_executable(filesystem_test test/filesystem_test.cpp filesystem.h test/catch.hpp)
|
|
if(CMAKE_GENERATOR STREQUAL Xcode)
|
|
add_executable(filesystem_test_cov test/filesystem_test.cpp filesystem.h test/catch.hpp)
|
|
target_compile_options(filesystem_test_cov PRIVATE "$<$<CONFIG:DEBUG>:--coverage>")
|
|
target_link_libraries(filesystem_test_cov PRIVATE --coverage)
|
|
endif()
|
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0))
|
|
include_directories(/usr/local/opt/llvm/include)
|
|
link_directories(/usr/local/opt/llvm/lib)
|
|
add_executable(std_filesystem_test test/filesystem_test.cpp filesystem.h test/catch.hpp)
|
|
set_property(TARGET std_filesystem_test PROPERTY CXX_STANDARD 17)
|
|
target_compile_definitions(std_filesystem_test PRIVATE USE_STD_FS)
|
|
target_link_libraries(std_filesystem_test -lc++fs)
|
|
endif()
|
|
if (CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0))
|
|
add_executable(std_filesystem_test test/filesystem_test.cpp filesystem.h test/catch.hpp)
|
|
set_property(TARGET std_filesystem_test PROPERTY CXX_STANDARD 17)
|
|
target_compile_definitions(std_filesystem_test PRIVATE USE_STD_FS)
|
|
target_link_libraries(std_filesystem_test -lstdc++fs)
|
|
endif()
|