Skip to content

Commit

Permalink
Added CMake option (#18)
Browse files Browse the repository at this point in the history
Added CMake option in order to choose encoding type
  • Loading branch information
garlix authored and GreyCat committed Sep 18, 2017
1 parent 0885450 commit 231c279
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ set (SOURCES
kaitai/kaitaistream.cpp
)

set(STRING_ENCODING_TYPE "ICONV" CACHE STRING "Set the way strings have to be encoded (ICONV|NONE|...)")

add_library (${PROJECT_NAME} SHARED ${HEADERS} ${SOURCES})

if (ZLIB_FOUND)
Expand All @@ -35,7 +37,14 @@ endif()
if(ICONV_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${ICONV_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${ICONV_LIBRARIES})
endif()

if (STRING_ENCODING_TYPE STREQUAL "ICONV")
target_compile_definitions(${PROJECT_NAME} PRIVATE -DKS_STR_ENCODING_ICONV)
elseif (STRING_ENCODING_TYPE STREQUAL "NONE")
target_compile_definitions(${PROJECT_NAME} PRIVATE -DKS_STR_ENCODING_NONE)
else()
# User action requested
endif()

if (WIN32)
Expand Down

0 comments on commit 231c279

Please sign in to comment.