Fix install dir of CycloneDDSConfig.cmake (#321)

Installing Cyclone DDS for multiple architectures with the same
installation prefix gave problems because the CMake configuration files
ended up overwriting each other.  This brings it in line with the
recommended locations.  Thanks to @hansfn.

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-11-17 21:27:45 +01:00 committed by eboasson
parent 3da21315f2
commit e43bdb73c7
9 changed files with 34 additions and 38 deletions

View file

@ -191,11 +191,12 @@ before_script:
# code has been vetted, the test has been run a great many times (with the odd
# failure), and so we now simply skip the test to avoid the spurious failures.
script:
- INSTALLPREFIX="$(pwd)/install"
- mkdir build
- cd build
- conan install -b missing -s arch=${ARCH} -s build_type=${BUILD_TYPE} ..
- cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=$(pwd)/install
-DCMAKE_INSTALL_PREFIX=${INSTALLPREFIX}
-DUSE_SANITIZER=${ASAN}
-DENABLE_SSL=${SSL}
-DBUILD_TESTING=on
@ -217,12 +218,15 @@ script:
CMAKE_LINKER_FLAGS="-DCMAKE_LINKER_FLAGS=-fsanitize=${USE_SANITIZER}";
CMAKE_C_FLAGS="-DCMAKE_C_FLAGS=-fsanitize=${USE_SANITIZER}";
fi
- mkdir install/share/CycloneDDS/examples/helloworld/build
- cd install/share/CycloneDDS/examples/helloworld/build
- cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
- cd ..
- mkdir helloworld_build
- cd helloworld_build
- cmake -DCMAKE_PREFIX_PATH=${INSTALLPREFIX}
-DCMAKE_BUILD_TYPE=${BUILD_TYPE}
${CMAKE_C_FLAGS}
${CMAKE_LINKER_FLAGS}
-G "${GENERATOR}" ..
-G "${GENERATOR}"
${INSTALLPREFIX}/share/CycloneDDS/examples/helloworld
- cmake --build . --config ${BUILD_TYPE}
- cd "${TRAVIS_BUILD_DIR}/build"

View file

@ -124,11 +124,10 @@ We will show you how to build and run an example program that measures latency.
built automatically when you build Cyclone DDS, so you don't need to follow these steps to be able
to run the program, it is merely to illustrate the process.
$ cd cyclonedds/examples/roundtrip
$ mkdir build
$ cd build
$ cmake ..
$ make
$ mkdir roundtrip
$ cd roundtrip
$ cmake <install-location>/share/CycloneDDS/examples/helloworld
$ cmake --build .
On one terminal start the application that will be responding to pings:

View file

@ -41,7 +41,7 @@ build_script:
- cd install/share/CycloneDDS/examples/helloworld
- mkdir build
- cd build
- cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "%GENERATOR%" ..
- cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DCMAKE_PREFIX_PATH=%CD%/../../../../.. -G "%GENERATOR%" ..
- cmake --build . --config %CONFIGURATION% -- /nologo /verbosity:minimal /maxcpucount /p:CL_MPCount=2
- cd ../../../../../..

View file

@ -18,7 +18,7 @@ include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
set(PACKAGING_MODULE_DIR "${PROJECT_SOURCE_DIR}/cmake/Modules/Packaging")
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}")
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
# Generates <Package>Config.cmake.
configure_package_config_file(

View file

@ -206,13 +206,12 @@ look in the default locations for the code:`CycloneDDS` package.
.. _`IdlcGenerate`:
The :code:`CycloneDDS` package provides the :code:`ddsc` library
that contains the DDS API that the application needs. But apart
from that, it also contains helper functionality
(:code:`idlc_generate`) to generate library targets from IDL
files. These library targets can be easily used when compiling
an application that depends on a data type described
in an IDL file.
The :code:`CycloneDDS` package provides the :code:`ddsc` library that
contains the DDS API that the application needs. It also provides a
component "idlc" that provides helper functionality for generating
library targets from IDL files (:code:`idlc_generate`). These library
targets can be easily used when compiling an application that depends on
a data type described in an IDL file.
Two applications will be created, :code:`HelloworldPublisher`
and :code:`HelloworldSubscriber`. Both consist only out of one
@ -241,7 +240,7 @@ Here, we can let CMake configure the build environment for
us by typing:
::
cmake ../
cmake ..
.. note::
CMake does a pretty good job at guessing which generator to use, but some

View file

@ -1,10 +1,8 @@
cmake_minimum_required(VERSION 3.5)
if (NOT TARGET CycloneDDS::ddsc)
# Find the CycloneDDS package. If it is not in a default location, try
# finding it relative to the example where it most likely resides.
find_package(CycloneDDS REQUIRED COMPONENTS idlc PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../")
endif()
# Find the CycloneDDS package. If it is not in a default location, try
# finding it relative to the example where it most likely resides.
find_package(CycloneDDS REQUIRED COMPONENTS idlc PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../../..")
# This is a convenience function, provided by the CycloneDDS package,
# that will supply a library target related the the given idl file.

View file

@ -11,11 +11,9 @@
#
cmake_minimum_required(VERSION 3.5)
if (NOT TARGET CycloneDDS::ddsc)
# Find the CycloneDDS package. If it is not in a default location, try
# finding it relative to the example where it most likely resides.
find_package(CycloneDDS REQUIRED COMPONENTS idlc PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../")
endif()
# Find the CycloneDDS package. If it is not in a default location, try
# finding it relative to the example where it most likely resides.
find_package(CycloneDDS REQUIRED COMPONENTS idlc PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../../..")
# This is a convenience function, provided by the CycloneDDS package,
# that will supply a library target related the the given idl file.

View file

@ -11,11 +11,9 @@
#
cmake_minimum_required(VERSION 3.5)
if (NOT TARGET CycloneDDS::ddsc)
# Find the CycloneDDS package. If it is not in a default location, try
# finding it relative to the example where it most likely resides.
find_package(CycloneDDS REQUIRED COMPONENTS idlc PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../")
endif()
# Find the CycloneDDS package. If it is not in a default location, try
# finding it relative to the example where it most likely resides.
find_package(CycloneDDS REQUIRED COMPONENTS idlc PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../../..")
# This is a convenience function, provided by the CycloneDDS package,
# that will supply a library target related the the given idl file.

View file

@ -45,17 +45,17 @@ include(cmake/IdlcGenerate.cmake)
install(
FILES "cmake/IdlcGenerate.cmake"
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/idlc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/idlc"
COMPONENT idlc)
install(
FILES "${IDLC_SCRIPT_IN}"
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/idlc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/idlc"
COMPONENT idlc)
install(
FILES "${IDLC_JAR}"
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/idlc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/idlc"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
COMPONENT idlc)