diff --git a/CMakeLists.txt b/CMakeLists.txt index 1dfb5def..bb3362a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,13 @@ set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}") set(SOVERSION ${VERSION}) message(STATUS "Building PIP version ${VERSION}${VERSION_SUFFIX}") file(WRITE "src/pip_version_str.h" "// This file was generated by PIP CMake, don`t edit it!\n#define __PIP_VERSION_STR__ \"${VERSION}${VERSION_SUFFIX}\"\n") + +#options +option(ICU "Uniccode support" ON) +option(USB "USB support" OFF) +option(STL "Building with STL containers" OFF) +option(CRYPTH "crypt support" OFF) +option(LIB "System install" ON) set(CMAKE_BUILD_TYPE "Release") set(LIBS) @@ -93,9 +100,8 @@ endif () # Check if USB is on (to enable use "-DUSB=" argument of cmake) -if (DEFINED USB) +if (USB) message(STATUS "Building with USB support") - unset(USB) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPIP_USB") list(APPEND LIBS usb) else () @@ -104,9 +110,8 @@ endif () # Check if STL containers is on (to enable use "-DSTL=" argument of cmake) -if (DEFINED STL) +if (STL) message(STATUS "Building with STL containers") - unset(STL) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPIP_CONTAINERS_STL") else () message(STATUS "Building with PIP containers") @@ -114,9 +119,8 @@ endif () # Check if ICU used for PIString and PIChar -if (DEFINED ICU) +if (ICU) message(STATUS "Building with ICU") - unset(ICU) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPIP_ICU") list(APPEND LIBS icuuc) else () @@ -125,9 +129,8 @@ endif () # Check if PIP support cryptographic encryption/decryption by using sodium library -if (DEFINED CRYPT) +if (CRYPT) message(STATUS "Building with crypt support") - unset(CRYPT) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPIP_CRYPT") list(APPEND LIBS sodium) else () @@ -185,8 +188,7 @@ target_link_libraries(pip_test pip)# ${QT_QTCORE_LIBRARY}) # Install # Check if system or local install will be used (to system install use "-DLIB=" argument of cmake) -if (DEFINED LIB) - set(LIB 1) +if (LIB) if (${WIN32}) find_package(MinGW REQUIRED) set(CMAKE_INSTALL_PREFIX ${MINGW_DIR}) diff --git a/make_lib.bat b/make_lib.bat index afe1db57..4c0e3ca9 100644 --- a/make_lib.bat +++ b/make_lib.bat @@ -1 +1 @@ -cmake_mgw -DLIB= && make install %* +cmake_mgw -DLIB=1 && make install %* diff --git a/make_lib_usb.bat b/make_lib_usb.bat index e456acad..f876d61c 100644 --- a/make_lib_usb.bat +++ b/make_lib_usb.bat @@ -1 +1 @@ -cmake_mgw -DLIB= -DUSB= && make install +cmake_mgw -DLIB=1 -DUSB=1 && make install