From 7bfcbebe0f7db7d336cae04ccdfdc3c2b1aff69b Mon Sep 17 00:00:00 2001 From: Mathias Preiner Date: Mon, 24 Sep 2018 11:44:41 -0700 Subject: [PATCH] cmake: Add program prefix option. (#2515) --- CMakeLists.txt | 3 +++ configure.sh | 7 +++++++ src/main/CMakeLists.txt | 14 ++++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b097a70d7..453f1bcf7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,9 @@ set(GMP_DIR "" CACHE STRING "Set GMP install directory") set(LFSC_DIR "" CACHE STRING "Set LFSC install directory") set(SYMFPU_DIR "" CACHE STRING "Set SymFPU install directory") +# Prepend binaries with prefix on make install +set(PROGRAM_PREFIX "" CACHE STRING "Program prefix on make install") + # Supported language bindings option(BUILD_BINDINGS_JAVA "Build Java bindings") option(BUILD_BINDINGS_PYTHON "Build Python bindings") diff --git a/configure.sh b/configure.sh index b92c48ad4..16764dd8a 100755 --- a/configure.sh +++ b/configure.sh @@ -15,6 +15,7 @@ Build types: General options; -h, --help display this help and exit --prefix=STR install directory + --program-prefix=STR prefix of binaries prepended on make install --name=STR use custom build directory name (optionally: +path) --best turn on dependencies known to give best performance --gpl permit GPL dependencies, if available @@ -95,6 +96,7 @@ msg () { build_dir=build install_prefix=default +program_prefix="" #--------------------------------------------------------------------------# @@ -174,6 +176,9 @@ do esac ;; + --program-prefix) die "missing argument to $1 (try -h)" ;; + --program-prefix=*) program_prefix=${1##*=} ;; + --name) die "missing argument to $1 (try -h)" ;; --name=*) build_dir=${1##*=} ;; @@ -401,6 +406,8 @@ cmake_opts="" && cmake_opts="$cmake_opts -DSYMFPU_DIR=$symfpu_dir" [ "$install_prefix" != default ] \ && cmake_opts="$cmake_opts -DCMAKE_INSTALL_PREFIX=$install_prefix" +[ -n "$program_prefix" ] \ + && cmake_opts="$cmake_opts -DPROGRAM_PREFIX=$program_prefix" root_dir=$(pwd) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 30a246ba0..dba12006e 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -45,7 +45,12 @@ set_target_properties(cvc4-bin OUTPUT_NAME cvc4 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) target_link_libraries(cvc4-bin cvc4 cvc4parser) -install(TARGETS cvc4-bin DESTINATION bin) +if(PROGRAM_PREFIX) + install(PROGRAMS + $ DESTINATION bin RENAME ${PROGRAM_PREFIX}cvc4) +else() + install(TARGETS cvc4-bin DESTINATION bin) +endif() # In order to get a fully static executable we have to make sure that we also # use the static system libraries. @@ -76,7 +81,12 @@ if(ENABLE_PORTFOLIO) RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) target_link_libraries(pcvc4-bin cvc4 cvc4parser ${Boost_LIBRARIES}) target_include_directories(pcvc4-bin PRIVATE ${Boost_INCLUDE_DIRS}) - install(TARGETS pcvc4-bin DESTINATION bin) + if(PROGRAM_PREFIX) + install(PROGRAMS + $ DESTINATION bin RENAME ${PROGRAM_PREFIX}pcvc4) + else() + install(TARGETS pcvc4-bin DESTINATION bin) + endif() if(NOT ENABLE_SHARED) set_target_properties(pcvc4-bin PROPERTIES LINK_FLAGS -static) -- 2.30.2