Merge 471476d358 into 68fba8aeca
This commit is contained in:
commit
f91caa3480
@ -26,7 +26,7 @@ RETURN()
|
|||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.8.12)
|
cmake_minimum_required(VERSION 3.1)
|
||||||
project(cxxopts)
|
project(cxxopts)
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
@ -37,9 +37,7 @@ option(CXXOPTS_BUILD_EXAMPLES "Set to ON to build examples" ON)
|
|||||||
option(CXXOPTS_BUILD_TESTS "Set to ON to build tests" OFF)
|
option(CXXOPTS_BUILD_TESTS "Set to ON to build tests" OFF)
|
||||||
|
|
||||||
set(CXXOPTS_LINKER_LIBRARIES "")
|
set(CXXOPTS_LINKER_LIBRARIES "")
|
||||||
|
|
||||||
set(CXXOPTS_USE_UNICODE_HELP FALSE CACHE BOOL "Use ICU Unicode library")
|
set(CXXOPTS_USE_UNICODE_HELP FALSE CACHE BOOL "Use ICU Unicode library")
|
||||||
|
|
||||||
if(CXXOPTS_USE_UNICODE_HELP)
|
if(CXXOPTS_USE_UNICODE_HELP)
|
||||||
|
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
@ -48,8 +46,25 @@ if(CXXOPTS_USE_UNICODE_HELP)
|
|||||||
|
|
||||||
set(CXXOPTS_LINKER_LIBRARIES "${ICU_LIBRARIES}")
|
set(CXXOPTS_LINKER_LIBRARIES "${ICU_LIBRARIES}")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCXXOPTS_USE_UNICODE")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCXXOPTS_USE_UNICODE")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_library(cxxopts INTERFACE)
|
||||||
|
target_sources(
|
||||||
|
cxxopts INTERFACE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/include/cxxopts.hpp
|
||||||
|
)
|
||||||
|
target_include_directories(
|
||||||
|
cxxopts INTERFACE
|
||||||
|
include/
|
||||||
|
)
|
||||||
|
target_link_libraries(
|
||||||
|
cxxopts
|
||||||
|
INTERFACE ${CXXOPTS_LINKER_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/cxxopts.hpp DESTINATION include)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -19,9 +19,8 @@
|
|||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
if(CXXOPTS_BUILD_EXAMPLES)
|
if(CXXOPTS_BUILD_EXAMPLES)
|
||||||
add_executable(example example.cpp cxxopts.hpp)
|
add_executable(example example.cpp)
|
||||||
|
target_link_libraries(example cxxopts)
|
||||||
target_link_libraries(example ${CXXOPTS_LINKER_LIBRARIES})
|
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_compile_options(example PUBLIC /W2)
|
target_compile_options(example PUBLIC /W2)
|
||||||
@ -29,5 +28,3 @@ if(CXXOPTS_BUILD_EXAMPLES)
|
|||||||
target_compile_options(example PUBLIC -std=c++11 -Wall)
|
target_compile_options(example PUBLIC -std=c++11 -Wall)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(FILES cxxopts.hpp DESTINATION include)
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
if (CXXOPTS_BUILD_TESTS)
|
if (CXXOPTS_BUILD_TESTS)
|
||||||
add_executable(options_test options.cpp)
|
add_executable(options_test options.cpp)
|
||||||
|
target_link_libraries(options_test cxxopts)
|
||||||
target_link_libraries(options_test ${CXXOPTS_LINKER_LIBRARIES})
|
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_compile_options(options_test PUBLIC /W2)
|
target_compile_options(options_test PUBLIC /W2)
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
|
||||||
#include "../src/cxxopts.hpp"
|
#include "cxxopts.hpp"
|
||||||
|
|
||||||
class Argv {
|
class Argv {
|
||||||
public:
|
public:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user