From c424e2b690b4716e02a862a4b27e87173944bc65 Mon Sep 17 00:00:00 2001 From: Chunting Gu Date: Thu, 18 Oct 2018 10:31:05 +0800 Subject: [PATCH] Add an option allowing to switch off CMake install. --- CMakeLists.txt | 1 + webcc/CMakeLists.txt | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f91e58..df1632a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,7 @@ project(webcc) option(WEBCC_ENABLE_LOG "Enable logging?" ON) option(WEBCC_ENABLE_SOAP "Enable SOAP support (need pugixml)?" ON) option(WEBCC_ENABLE_SSL "Enable SSL/HTTPS support (need OpenSSL)?" OFF) +option(WEBCC_ENABLE_INSTALL "Enable to install library and headers with CMake?" OFF) option(WEBCC_BUILD_UNITTEST "Build unit test?" ON) option(WEBCC_BUILD_EXAMPLE "Build examples?" ON) diff --git a/webcc/CMakeLists.txt b/webcc/CMakeLists.txt index 0a73031..cd52f30 100644 --- a/webcc/CMakeLists.txt +++ b/webcc/CMakeLists.txt @@ -102,9 +102,10 @@ set(TARGET webcc) add_library(${TARGET} STATIC ${HEADERS} ${SOURCES}) -# Install lib and header files. -# On Linux, if CMAKE_INSTALL_PREFIX is ~, the lib (libwebcc.a) will be installed -# to ~/lib and header files will be installed to ~/include. - -install(TARGETS ${TARGET} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/webcc) +if(WEBCC_ENABLE_INSTALL) + # Install lib and header files. + # On Linux, if CMAKE_INSTALL_PREFIX is ~, the lib (libwebcc.a) will be installed + # to ~/lib and header files will be installed to ~/include. + install(TARGETS ${TARGET} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/webcc) +endif()