Skip to content

Commit

Permalink
Make C++ library install prefix configurable
Browse files Browse the repository at this point in the history
Currently project name is used as a generated C++ library install prefix.
Add CMake setting LIBRARY_INSTALL_PREFIX to make it configurable.

#1
  • Loading branch information
vontikov committed Sep 3, 2018
1 parent 4bd325c commit aac9586
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
5 changes: 5 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v0.0.2
------
[Make C++ library install prefix configurable](https://github.com/vontikov/sbe-gradle-plugin/issues/1)

Initial release
v0.0.1
------
Initial release
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
artifact_name=sbe-generator-plugin
artifact_group=vontikov
artifact_version=0.0.1
artifact_version=0.0.2
2 changes: 1 addition & 1 deletion src/main/groovy/vontikov/SbeGeneratorPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class SbeGeneratorPlugin implements Plugin<Project> {
into(ext.cppCmakeDir)
from(project.file(TMP_DIR + '/' + cmakeScript))
filter {
it.startsWith('@') ?
it.startsWith('@PROJECT') ?
"project(${nm} VERSION ${project.version})"
: it
}
Expand Down
20 changes: 14 additions & 6 deletions src/main/resources/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.0)

@
@PROJECT

#
# Options
Expand All @@ -19,7 +19,7 @@ set(VERSION_FILE_NAME ${GEN_DIR}/${PROJECT_NAME}ConfigVersion.cmake)
set(TARGETS_FILE_NAME ${PROJECT_NAME}Targets)

#
# Configuragle settings
# Configurable settings
#
include(GNUInstallDirs)

Expand All @@ -33,7 +33,7 @@ set(DEFAULT_BUILD_TYPE "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(
CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}"
CACHE STRING "Choose the type of build."
CACHE STRING "Choose the type of build"
FORCE
)
set_property(
Expand All @@ -46,14 +46,22 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
)
endif()

if(NOT LIBRARY_INSTALL_PREFIX)
set(
LIBRARY_INSTALL_PREFIX "${PROJECT_NAME}"
CACHE STRING "Choose project install prefix"
FORCE
)
endif()

set(
LIBRARY_INSTALL_DIR "lib"
CACHE PATH "The library installation directory"
CACHE PATH "Library installation directory"
FORCE
)

set(CONFIG_INSTALL_DIR "${LIBRARY_INSTALL_DIR}/${PROJECT_NAME}/cmake")
set(INCLUDE_INSTALL_DIR "${LIBRARY_INSTALL_DIR}/${PROJECT_NAME}/${CMAKE_INSTALL_INCLUDEDIR}")
set(CONFIG_INSTALL_DIR "${LIBRARY_INSTALL_DIR}/${LIBRARY_INSTALL_PREFIX}/cmake")
set(INCLUDE_INSTALL_DIR "${LIBRARY_INSTALL_DIR}/${LIBRARY_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
set(INCLUDE_EXPORT_DIR "${CMAKE_INSTALL_INCLUDEDIR}")

#
Expand Down

0 comments on commit aac9586

Please sign in to comment.