unicode configuration
This commit is contained in:
parent
8234766bca
commit
8d7c4ea43e
@ -23,9 +23,20 @@ project(cxxopts)
|
|||||||
|
|
||||||
set(VERSION "0.0.1")
|
set(VERSION "0.0.1")
|
||||||
|
|
||||||
find_package(PkgConfig)
|
set(CXXOPTS_LINKER_LIBRARIES "")
|
||||||
|
|
||||||
pkg_check_modules(ICU REQUIRED icu-uc)
|
set(CXXOPTS_USE_UNICODE_HELP FALSE CACHE BOOL "Use ICU Unicode library")
|
||||||
|
|
||||||
|
if(CXXOPTS_USE_UNICODE_HELP)
|
||||||
|
|
||||||
|
find_package(PkgConfig)
|
||||||
|
|
||||||
|
pkg_check_modules(ICU REQUIRED icu-uc)
|
||||||
|
|
||||||
|
set(CXXOPTS_LINKER_LIBRARIES "${ICU_LIBRARIES}")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCXXOPTS_USE_UNICODE")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,6 @@
|
|||||||
add_executable(example example.cpp)
|
add_executable(example example.cpp)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
|
||||||
target_link_libraries(example ${ICU_LIBRARIES})
|
target_link_libraries(example ${CXXOPTS_LINKER_LIBRARIES})
|
||||||
|
|
||||||
install(FILES cxxopts.hpp DESTINATION include)
|
install(FILES cxxopts.hpp DESTINATION include)
|
||||||
|
|||||||
@ -24,8 +24,6 @@ THE SOFTWARE.
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#define CXXOPTS_USE_UNICODE
|
|
||||||
|
|
||||||
#include "cxxopts.hpp"
|
#include "cxxopts.hpp"
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
@ -48,8 +46,10 @@ int main(int argc, char* argv[])
|
|||||||
("help", "Print help")
|
("help", "Print help")
|
||||||
("int", "An integer", cxxopts::value<int>())
|
("int", "An integer", cxxopts::value<int>())
|
||||||
("option_that_is_too_long_for_the_help", "A very long option")
|
("option_that_is_too_long_for_the_help", "A very long option")
|
||||||
("unicode", u8"A help option with non-ascii: à. Here the length of the"
|
#ifdef CXXOPTS_USE_UNICODE
|
||||||
|
("unicode", u8"A help option with non-ascii: à. Here the size of the"
|
||||||
" string should be correct")
|
" string should be correct")
|
||||||
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
options.add_options("Group")
|
options.add_options("Group")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user