diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..32e4b9c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.7) + +project(TCLAP VERSION 1.2.2) + +set(CMAKE_CXX_STANDARD 98) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +add_subdirectory(examples) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..457c95f --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,27 @@ +SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIRECTORY}") +SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIRECTORY}") + +SET(gcc_like_cxx "$,$,$,$>") +SET(msvc_cxx "$") + +function(default_opts target) +target_compile_options(${target} PRIVATE + "$<${gcc_like_cxx}:$>" + "$<${msvc_cxx}:$>" +) +endfunction(default_opts) + +function(add_example name) + add_executable(${name} ${ARGN}) + target_include_directories(${name} PUBLIC ../include/ ${PROJECT_BINARY_DIR}) + default_opts(${name}) +endfunction() + +# Check we don't define any hard symbols in the headers +add_example(test-hard test-hard-1.cpp test-hard-2.cpp) + +file(GLOB TEST_FILES test[0-9]*.cpp) +foreach(file ${TEST_FILES}) + get_filename_component(file_basename ${file} NAME_WE) + add_example(${file_basename} ${file}) +endforeach() diff --git a/examples/Makefile.am b/examples/Makefile.am index cad4369..8c06efb 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -20,7 +20,7 @@ test13_SOURCES = test13.cpp test14_SOURCES = test14.cpp test15_SOURCES = test15.cpp test16_SOURCES = test16.cpp -test17_SOURCES = test17.cpp test17-a.cpp +test17_SOURCES = test-hard-1.cpp test-hard-2.cpp test18_SOURCES = test18.cpp test19_SOURCES = test19.cpp test20_SOURCES = test20.cpp diff --git a/examples/test17-a.cpp b/examples/test-hard-1.cpp similarity index 100% rename from examples/test17-a.cpp rename to examples/test-hard-1.cpp diff --git a/examples/test17.cpp b/examples/test-hard-2.cpp similarity index 100% rename from examples/test17.cpp rename to examples/test-hard-2.cpp