diff --git a/.ci/make_and_test.sh b/.ci/make_and_test.sh index e05ae140..6aec305e 100755 --- a/.ci/make_and_test.sh +++ b/.ci/make_and_test.sh @@ -8,7 +8,7 @@ set -evx mkdir -p build cd build -cmake .. -DCLI11_CXX_STD=$STD -DCLI11_SINGLE_FILE_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER_LAUNCHER=ccache $@ +cmake .. -DCLI11_SINGLE_FILE=ON -DCLI11_CXX_STD=$STD -DCLI11_SINGLE_FILE_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER_LAUNCHER=ccache $@ cmake --build . -- -j2 set +evx diff --git a/CMakeLists.txt b/CMakeLists.txt index 85b16905..363ce19c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,33 +112,16 @@ export(TARGETS CLI11 # Register in the user cmake package registry export(PACKAGE CLI11) -# Single file test -if(CMAKE_VERSION VERSION_LESS 3.12) - set(Python_ADDITIONAL_VERSIONS 2.7 3.4 3.5 3.6 3.7 3.8) - find_package(PythonInterp) - set(Python_VERSION ${PYTHON_VERSION_STRING}) - set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}") -else() - find_package(Python) -endif() - -if(Python_Interpreter_FOUND OR PYTHONINTERP_FOUND) - if(Python_VERSION VERSION_LESS 2.7) - set(CLI11_PYTHON_FOUND FALSE) - else() - set(CLI11_PYTHON_FOUND TRUE) - endif() -else() - set(CLI11_PYTHON_FOUND FALSE) -endif() - -cmake_dependent_option(CLI11_SINGLE_FILE "Generate a single header file" ON "CUR_PROJ;CLI11_PYTHON_FOUND" OFF) +option(CLI11_SINGLE_FILE "Generate a single header file" OFF) if(CLI11_SINGLE_FILE) - if(NOT CLI11_PYTHON_FOUND) - message(FATAL_ERROR "CLI11_SINGLE_FILE requires Python 2.7 or 3 (not found)") +# Single file test + if(CMAKE_VERSION VERSION_LESS 3.12) + find_package(PythonInterp REQUIRED) + set(Python_VERSION ${PYTHON_VERSION_STRING}) + set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}") else() - message(STATUS "Building single file include using Python ${Python_VERSION} at ${Python_EXECUTABLE}") + find_package(Python REQUIRED) endif() file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include") diff --git a/LICENSE b/LICENSE index d3d8f012..6b007783 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -CLI11 1.5 Copyright (c) 2017-2018 University of Cincinnati, developed by Henry +CLI11 1.6 Copyright (c) 2017-2018 University of Cincinnati, developed by Henry Schreiner under NSF AWARD 1414736. All rights reserved. Redistribution and use in source and binary forms of CLI11, with or without diff --git a/scripts/MakeSingleHeader.py b/scripts/MakeSingleHeader.py index 56e875d0..b474864d 100755 --- a/scripts/MakeSingleHeader.py +++ b/scripts/MakeSingleHeader.py @@ -9,7 +9,7 @@ import operator from copy import copy from functools import reduce -import subprocess +from subprocess import Popen, PIPE includes_local = re.compile(r"""^#include "(.*)"$""", re.MULTILINE) includes_system = re.compile(r"""^#include \<(.*)\>$""", re.MULTILINE) @@ -112,12 +112,13 @@ class HeaderFile(object): def MakeHeader(output, main_header, include_dir = '../include', namespace=None, macro=None): # Set tag if possible to class variable try: - proc = subprocess.Popen(['git', 'describe', '--tags', '--always'], cwd=str(DIR), stdout=subprocess.PIPE) + proc = Popen(['git', 'describe', '--tags', '--always'], cwd=str(DIR), stdout=PIPE) out, _ = proc.communicate() - if proc.returncode == 0: - HeaderFile.TAG = out.decode("utf-8").strip() except OSError: pass + else: + if proc.returncode == 0: + HeaderFile.TAG = out.decode("utf-8").strip() base_dir = os.path.abspath(os.path.join(DIR, include_dir)) main_header = os.path.join(base_dir, main_header)