mirror of
https://github.com/arun11299/cpp-subprocess.git
synced 2025-08-04 12:26:19 -04:00
chore: improve CMake files (#85)
This commit is contained in:
parent
1392c47cbb
commit
d9ed0d606f
@ -6,6 +6,6 @@ compiler:
|
||||
|
||||
script:
|
||||
- mkdir -p build && cd build
|
||||
- cmake -DCMAKE_BUILD_TYPE=Debug ..
|
||||
- cmake -DCMAKE_BUILD_TYPE=Debug -DSUBPROCESS_TESTS=ON ..
|
||||
- cmake --build . --config Debug -- -j $(nproc)
|
||||
- ctest -j $(nproc) --output-on-failure
|
@ -1,15 +1,18 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(subprocess VERSION 0.0.1 LANGUAGES CXX)
|
||||
|
||||
project(subprocess CXX)
|
||||
set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard to use")
|
||||
option(EXPORT_COMPILE_COMMANDS "create clang compile database" ON)
|
||||
option(SUBPROCESS_TESTS "enalbe subprocess tests" OFF)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
include(CTest)
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
add_library(subprocess INTERFACE)
|
||||
target_include_directories(subprocess INTERFACE .)
|
||||
|
||||
target_link_libraries(subprocess INTERFACE Threads::Threads)
|
||||
target_include_directories(subprocess INTERFACE . )
|
||||
install(FILES subprocess.hpp DESTINATION include/cpp-subprocess/)
|
||||
|
||||
if(SUBPROCESS_TESTS)
|
||||
include(CTest)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
@ -1,16 +1,15 @@
|
||||
set(test_names test_subprocess test_cat test_env test_err_redirection test_split test_main test_ret_code)
|
||||
set(test_files env_script.sh write_err.sh write_err.txt)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
foreach(test_name IN LISTS test_names)
|
||||
add_executable(${test_name} ${test_name}.cc)
|
||||
target_link_libraries(${test_name} PRIVATE Threads::Threads)
|
||||
target_link_libraries(${test_name} PRIVATE subprocess)
|
||||
|
||||
add_test(
|
||||
NAME ${test_name}
|
||||
COMMAND $<TARGET_FILE:${test_name}>
|
||||
)
|
||||
)
|
||||
endforeach()
|
||||
|
||||
foreach(test_file IN LISTS test_files)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <iostream>
|
||||
#include "../subprocess.hpp"
|
||||
#include <subprocess.hpp>
|
||||
|
||||
namespace sp = subprocess;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <iostream>
|
||||
#include "../subprocess.hpp"
|
||||
#include <subprocess.hpp>
|
||||
|
||||
using namespace subprocess;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <iostream>
|
||||
#include "../subprocess.hpp"
|
||||
#include <subprocess.hpp>
|
||||
|
||||
using namespace subprocess;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <iostream>
|
||||
#include "../subprocess.hpp"
|
||||
#include <subprocess.hpp>
|
||||
|
||||
namespace sp = subprocess;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <iostream>
|
||||
#include "../subprocess.hpp"
|
||||
#include <subprocess.hpp>
|
||||
|
||||
using namespace subprocess;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user