From 92f936fdb83482e6d2edc0280bee089cfc9b9771 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Thu, 21 Oct 2010 12:45:51 -0500 Subject: [PATCH] binpac: Added headers to install target. Also set some convenience variables that mimic what a FindBinPAC module would set. These could be used by a superproject that wants to decide whether to use an existing BinPAC installation or (re)build from source. --- tools/binpac/CMakeLists.txt | 8 +++++++- tools/binpac/lib/CMakeLists.txt | 27 +++++++++++++++++++++++++-- tools/binpac/src/CMakeLists.txt | 9 ++++++++- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/tools/binpac/CMakeLists.txt b/tools/binpac/CMakeLists.txt index 3d59e02e86..bf8c2fe233 100644 --- a/tools/binpac/CMakeLists.txt +++ b/tools/binpac/CMakeLists.txt @@ -79,10 +79,16 @@ add_subdirectory(src) ## Build Summary ## +if (BinPAC_SKIP_INSTALL) + set(binpac_install_summary "Install skipped") +else () + set(binpac_install_summary "${CMAKE_INSTALL_PREFIX}") +endif () + message( "\n==================| BinPAC Build Summary |====================" "\n" - "\nInstall prefix: ${CMAKE_INSTALL_PREFIX}" + "\nInstall prefix: ${binpac_install_summary}" "\nDebug mode: ${ENABLE_DEBUG}" "\nRelease mode: ${ENABLE_RELEASE}" "\n" diff --git a/tools/binpac/lib/CMakeLists.txt b/tools/binpac/lib/CMakeLists.txt index f7ed65f2c8..996bbf1c18 100644 --- a/tools/binpac/lib/CMakeLists.txt +++ b/tools/binpac/lib/CMakeLists.txt @@ -13,7 +13,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} set(binpac_lib_SRCS binpac_buffer.cc binpac_bytestring.cc - binpac.h + ${CMAKE_CURRENT_BINARY_DIR}/binpac.h binpac_analyzer.h binpac_buffer.h binpac_bytestring.h @@ -25,4 +25,27 @@ add_library(binpac_lib STATIC ${binpac_lib_SRCS}) set_target_properties(binpac_lib PROPERTIES OUTPUT_NAME binpac) -install(TARGETS binpac_lib DESTINATION lib) +if (NOT BinPAC_SKIP_INSTALL) + install(TARGETS binpac_lib DESTINATION lib) + install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/binpac.h + binpac_analyzer.h + binpac_buffer.h + binpac_bytestring.h + binpac_exception.h + binpac_regex.h + DESTINATION + include + ) +endif () + +# This is set to assist superprojects that want to build BinPac +# from source and rely on it as a target +set(BinPAC_LIBRARY binpac_lib + CACHE STRING "BinPAC static library" FORCE +) + +set(BinPAC_INCLUDE_DIR + ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} + CACHE STRING "BinPAC header directories" FORCE +) diff --git a/tools/binpac/src/CMakeLists.txt b/tools/binpac/src/CMakeLists.txt index bbaedaf53f..5e9881138c 100644 --- a/tools/binpac/src/CMakeLists.txt +++ b/tools/binpac/src/CMakeLists.txt @@ -97,4 +97,11 @@ set(binpac_SRCS add_executable(binpac ${binpac_SRCS}) -install(TARGETS binpac DESTINATION bin) +if (NOT BinPAC_SKIP_INSTALL) + install(TARGETS binpac DESTINATION bin) +endif () + +# This is set to assist superprojects that want to build BinPac +# from source and rely on it as a target +set(BinPAC_EXE binpac + CACHE STRING "BinPAC executable" FORCE)