mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-06-11 02:36:33 +08:00
40 lines
2.2 KiB
CMake
40 lines
2.2 KiB
CMake
|
|
add_executable(filesystem_test filesystem_test.cpp ../filesystem.h catch.hpp)
|
|
target_compile_options(filesystem_test PRIVATE
|
|
$<$<CXX_COMPILER_ID:Clang>:-Wall -Wextra -Werror>
|
|
$<$<CXX_COMPILER_ID:GNU>:-Wall -Werror>
|
|
$<$<CXX_COMPILER_ID:MSVC>:/WX>)
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
|
target_compile_definitions(filesystem_test PRIVATE _CRT_SECURE_NO_WARNINGS)
|
|
endif()
|
|
if(CMAKE_GENERATOR STREQUAL Xcode)
|
|
add_executable(filesystem_test_cov filesystem_test.cpp ../filesystem.h 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 7.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0))
|
|
if(APPLE)
|
|
include_directories(/usr/local/opt/llvm/include)
|
|
link_directories(/usr/local/opt/llvm/lib)
|
|
endif()
|
|
add_executable(std_filesystem_test filesystem_test.cpp ../filesystem.h 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 filesystem_test.cpp ../filesystem.h 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()
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 19.15 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.15))
|
|
add_executable(std_filesystem_test filesystem_test.cpp ../filesystem.h catch.hpp)
|
|
set_property(TARGET std_filesystem_test PROPERTY CXX_STANDARD 17)
|
|
target_compile_options(std_filesystem_test PRIVATE "/Zc:__cplusplus")
|
|
target_compile_definitions(std_filesystem_test PRIVATE USE_STD_FS _CRT_SECURE_NO_WARNINGS)
|
|
endif()
|
|
|
|
add_executable(multifile_test multi1.cpp multi2.cpp ../filesystem.h catch.hpp)
|