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:
parent
3da21315f2
commit
e43bdb73c7
9 changed files with 34 additions and 38 deletions
14
.travis.yml
14
.travis.yml
|
@ -191,11 +191,12 @@ before_script:
|
||||||
# code has been vetted, the test has been run a great many times (with the odd
|
# 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.
|
# failure), and so we now simply skip the test to avoid the spurious failures.
|
||||||
script:
|
script:
|
||||||
|
- INSTALLPREFIX="$(pwd)/install"
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- conan install -b missing -s arch=${ARCH} -s build_type=${BUILD_TYPE} ..
|
- conan install -b missing -s arch=${ARCH} -s build_type=${BUILD_TYPE} ..
|
||||||
- cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
|
- cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
|
||||||
-DCMAKE_INSTALL_PREFIX=$(pwd)/install
|
-DCMAKE_INSTALL_PREFIX=${INSTALLPREFIX}
|
||||||
-DUSE_SANITIZER=${ASAN}
|
-DUSE_SANITIZER=${ASAN}
|
||||||
-DENABLE_SSL=${SSL}
|
-DENABLE_SSL=${SSL}
|
||||||
-DBUILD_TESTING=on
|
-DBUILD_TESTING=on
|
||||||
|
@ -217,12 +218,15 @@ script:
|
||||||
CMAKE_LINKER_FLAGS="-DCMAKE_LINKER_FLAGS=-fsanitize=${USE_SANITIZER}";
|
CMAKE_LINKER_FLAGS="-DCMAKE_LINKER_FLAGS=-fsanitize=${USE_SANITIZER}";
|
||||||
CMAKE_C_FLAGS="-DCMAKE_C_FLAGS=-fsanitize=${USE_SANITIZER}";
|
CMAKE_C_FLAGS="-DCMAKE_C_FLAGS=-fsanitize=${USE_SANITIZER}";
|
||||||
fi
|
fi
|
||||||
- mkdir install/share/CycloneDDS/examples/helloworld/build
|
- cd ..
|
||||||
- cd install/share/CycloneDDS/examples/helloworld/build
|
- mkdir helloworld_build
|
||||||
- cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
|
- cd helloworld_build
|
||||||
|
- cmake -DCMAKE_PREFIX_PATH=${INSTALLPREFIX}
|
||||||
|
-DCMAKE_BUILD_TYPE=${BUILD_TYPE}
|
||||||
${CMAKE_C_FLAGS}
|
${CMAKE_C_FLAGS}
|
||||||
${CMAKE_LINKER_FLAGS}
|
${CMAKE_LINKER_FLAGS}
|
||||||
-G "${GENERATOR}" ..
|
-G "${GENERATOR}"
|
||||||
|
${INSTALLPREFIX}/share/CycloneDDS/examples/helloworld
|
||||||
- cmake --build . --config ${BUILD_TYPE}
|
- cmake --build . --config ${BUILD_TYPE}
|
||||||
- cd "${TRAVIS_BUILD_DIR}/build"
|
- cd "${TRAVIS_BUILD_DIR}/build"
|
||||||
|
|
||||||
|
|
|
@ -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
|
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.
|
to run the program, it is merely to illustrate the process.
|
||||||
|
|
||||||
$ cd cyclonedds/examples/roundtrip
|
$ mkdir roundtrip
|
||||||
$ mkdir build
|
$ cd roundtrip
|
||||||
$ cd build
|
$ cmake <install-location>/share/CycloneDDS/examples/helloworld
|
||||||
$ cmake ..
|
$ cmake --build .
|
||||||
$ make
|
|
||||||
|
|
||||||
On one terminal start the application that will be responding to pings:
|
On one terminal start the application that will be responding to pings:
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ build_script:
|
||||||
- cd install/share/CycloneDDS/examples/helloworld
|
- cd install/share/CycloneDDS/examples/helloworld
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd 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
|
- cmake --build . --config %CONFIGURATION% -- /nologo /verbosity:minimal /maxcpucount /p:CL_MPCount=2
|
||||||
- cd ../../../../../..
|
- cd ../../../../../..
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ include(CMakePackageConfigHelpers)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
set(PACKAGING_MODULE_DIR "${PROJECT_SOURCE_DIR}/cmake/Modules/Packaging")
|
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.
|
# Generates <Package>Config.cmake.
|
||||||
configure_package_config_file(
|
configure_package_config_file(
|
||||||
|
|
|
@ -206,13 +206,12 @@ look in the default locations for the code:`CycloneDDS` package.
|
||||||
|
|
||||||
.. _`IdlcGenerate`:
|
.. _`IdlcGenerate`:
|
||||||
|
|
||||||
The :code:`CycloneDDS` package provides the :code:`ddsc` library
|
The :code:`CycloneDDS` package provides the :code:`ddsc` library that
|
||||||
that contains the DDS API that the application needs. But apart
|
contains the DDS API that the application needs. It also provides a
|
||||||
from that, it also contains helper functionality
|
component "idlc" that provides helper functionality for generating
|
||||||
(:code:`idlc_generate`) to generate library targets from IDL
|
library targets from IDL files (:code:`idlc_generate`). These library
|
||||||
files. These library targets can be easily used when compiling
|
targets can be easily used when compiling an application that depends on
|
||||||
an application that depends on a data type described
|
a data type described in an IDL file.
|
||||||
in an IDL file.
|
|
||||||
|
|
||||||
Two applications will be created, :code:`HelloworldPublisher`
|
Two applications will be created, :code:`HelloworldPublisher`
|
||||||
and :code:`HelloworldSubscriber`. Both consist only out of one
|
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:
|
us by typing:
|
||||||
::
|
::
|
||||||
|
|
||||||
cmake ../
|
cmake ..
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
CMake does a pretty good job at guessing which generator to use, but some
|
CMake does a pretty good job at guessing which generator to use, but some
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
if (NOT TARGET CycloneDDS::ddsc)
|
# Find the CycloneDDS package. If it is not in a default location, try
|
||||||
# Find the CycloneDDS package. If it is not in a default location, try
|
# finding it relative to the example where it most likely resides.
|
||||||
# finding it relative to the example where it most likely resides.
|
find_package(CycloneDDS REQUIRED COMPONENTS idlc PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../../..")
|
||||||
find_package(CycloneDDS REQUIRED COMPONENTS idlc PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# This is a convenience function, provided by the CycloneDDS package,
|
# This is a convenience function, provided by the CycloneDDS package,
|
||||||
# that will supply a library target related the the given idl file.
|
# that will supply a library target related the the given idl file.
|
||||||
|
|
|
@ -11,11 +11,9 @@
|
||||||
#
|
#
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
if (NOT TARGET CycloneDDS::ddsc)
|
# Find the CycloneDDS package. If it is not in a default location, try
|
||||||
# Find the CycloneDDS package. If it is not in a default location, try
|
# finding it relative to the example where it most likely resides.
|
||||||
# finding it relative to the example where it most likely resides.
|
find_package(CycloneDDS REQUIRED COMPONENTS idlc PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../../..")
|
||||||
find_package(CycloneDDS REQUIRED COMPONENTS idlc PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# This is a convenience function, provided by the CycloneDDS package,
|
# This is a convenience function, provided by the CycloneDDS package,
|
||||||
# that will supply a library target related the the given idl file.
|
# that will supply a library target related the the given idl file.
|
||||||
|
|
|
@ -11,11 +11,9 @@
|
||||||
#
|
#
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
if (NOT TARGET CycloneDDS::ddsc)
|
# Find the CycloneDDS package. If it is not in a default location, try
|
||||||
# Find the CycloneDDS package. If it is not in a default location, try
|
# finding it relative to the example where it most likely resides.
|
||||||
# finding it relative to the example where it most likely resides.
|
find_package(CycloneDDS REQUIRED COMPONENTS idlc PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../../..")
|
||||||
find_package(CycloneDDS REQUIRED COMPONENTS idlc PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# This is a convenience function, provided by the CycloneDDS package,
|
# This is a convenience function, provided by the CycloneDDS package,
|
||||||
# that will supply a library target related the the given idl file.
|
# that will supply a library target related the the given idl file.
|
||||||
|
|
|
@ -45,17 +45,17 @@ include(cmake/IdlcGenerate.cmake)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES "cmake/IdlcGenerate.cmake"
|
FILES "cmake/IdlcGenerate.cmake"
|
||||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/idlc"
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/idlc"
|
||||||
COMPONENT idlc)
|
COMPONENT idlc)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES "${IDLC_SCRIPT_IN}"
|
FILES "${IDLC_SCRIPT_IN}"
|
||||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/idlc"
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/idlc"
|
||||||
COMPONENT idlc)
|
COMPONENT idlc)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES "${IDLC_JAR}"
|
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
|
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
||||||
COMPONENT idlc)
|
COMPONENT idlc)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue