change CmakeLists.txt to options

git-svn-id: svn://db.shs.com.ru/pip@153 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2015-09-17 18:06:15 +00:00
parent e2d60df46e
commit 7e0d007921
3 changed files with 14 additions and 12 deletions

View File

@@ -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})

View File

@@ -1 +1 @@
cmake_mgw -DLIB= && make install %*
cmake_mgw -DLIB=1 && make install %*

View File

@@ -1 +1 @@
cmake_mgw -DLIB= -DUSB= && make install
cmake_mgw -DLIB=1 -DUSB=1 && make install