cyclonedds/cmake/Modules/Packaging/PackageConfig.cmake.in
Dan Rose d12b926ff1 Move IDLC to its own install component
This allows you to express a dependency on it as `find_package(CycloneDDS REQUIRED COMPONENTS idlc)`
Also added a warning if CycloneDDS was built with IDLC but IDLC is not requested.

Signed-off-by: Dan Rose <dan@digilabs.io>
2019-11-14 10:02:01 +01:00

38 lines
1.5 KiB
CMake

#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
option("@PROJECT_NAME@_IDLC_ALWAYS" "Should we include idlc even if the user didn't request the idlc component?" ON)
set("@PROJECT_NAME@_idlc_FOUND" FALSE)
if ("idlc" IN_LIST "@PROJECT_NAME@_FIND_COMPONENTS" OR "@PROJECT_NAME@_IDLC_ALWAYS")
include("${CMAKE_CURRENT_LIST_DIR}/idlc/IdlcGenerate.cmake" OPTIONAL RESULT_VARIABLE _IdlcGenerate)
if(NOT _IdlcGenerate STREQUAL "NOTFOUND")
set("@PROJECT_NAME@_idlc_FOUND" TRUE)
endif()
endif()
if ("${@PROJECT_NAME@_IDLC_ALWAYS}"
AND "${@PROJECT_NAME@_idlc_FOUND}"
AND (NOT "idlc" IN_LIST "@PROJECT_NAME@_FIND_COMPONENTS")
)
message(AUTHOR_WARNING "\
The IDL Compiler 'idlc' has not been requested but has been built is automatically included. \
This will change in a future release. \
If you need the idlc compiler, please add idlc to the COMPONENTS or OPTIONAL_COMPONENTS list in \
find_package(@PROJECT_NAME@ ...). \
If you don't need it, set the @PROJECT_NAME@_IDLC_ALWAYS=OFF to suppress this message .\
")
endif()
check_required_components("@PROJECT_NAME@")