# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to you under the Apache License, Version # 2.0 (the "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Try to find or download capu #Once done this will define #LIBCAPU_FOUND - System has capu #LIBCAPU_INCLUDE_DIR - The capu include directory #LIBCAPU_LIBRARY_DIR - The library needed to use capu IF (NOT DEFINED CMAKE_BUILD_TYPE) MESSAGE(FATAL_ERROR "CMAKE_BUILD_TYPE not set") ENDIF() IF ("${CAPU_INCLUDE_DIR}" STREQUAL "" AND "${CAPU_LIBRARY_DIR}" STREQUAL "") include(ExternalProject) IF ("${LOCAL_CAPU_SOURCE_DIR}" STREQUAL "") #download capu from foreign repository MESSAGE("Download capu from github repository") SET(CAPU_PROJECT_DIR "${CMAKE_BINARY_DIR}/3rd/capu") SET(CAPU_CMAKE_BUILD_DIR "${CAPU_BUILD_DIR}/${TARGET_OS}_${TARGET_ARCH}") SET(CAPU_INSTALL_DIR ${CAPU_BUILD_DIR}/deliverable) ExternalProject_Add( Capu_external URL https://github.com/bmwcarit/capu/archive/v0.19.0.zip SOURCE_DIR "${CAPU_PROJECT_DIR}" BINARY_DIR "${CAPU_CMAKE_BUILD_DIR}" INSTALL_DIR "${CAPU_INSTALL_DIR}" UPDATE_COMMAND "" CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCapu_BUILD_TESTS:BOOLEAN=${CONFIG_BUILD_UNITTESTS} -DCMAKE_INSTALL_PREFIX:PATH=${CAPU_INSTALL_DIR} INSTALL 1 ) ELSE() SET(CAPU_PROJECT_DIR "${LOCAL_CAPU_SOURCE_DIR}") SET(CAPU_CMAKE_BUILD_DIR "${CAPU_BUILD_DIR}/${TARGET_OS}_${TARGET_ARCH}") ExternalProject_Add( Capu_external SOURCE_DIR "${CAPU_PROJECT_DIR}" BINARY_DIR "${CAPU_CMAKE_BUILD_DIR}" DOWNLOAD_COMMAND "" UPDATE_COMMAND "" INSTALL_DIR "${CAPU_INSTALL_DIR}" CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCapu_BUILD_TESTS:BOOL=${CONFIG_BUILD_UNITTESTS} -DCMAKE_INSTALL_PREFIX:PATH=${CAPU_INSTALL_DIR} INSTALL 1 ) ENDIF() SET(LIBCAPU_INCLUDE_DIR ${CAPU_INSTALL_DIR}/include) SET(LIBCAPU_LIBRARY_DIR ${CAPU_INSTALL_DIR}/lib) SET(LIBCAPU_BINARY_DIR ${CAPU_INSTALL_DIR}/bin) ELSE() SET(LIBCAPU_INCLUDE_DIR ${CAPU_INCLUDE_DIR}) SET(LIBCAPU_LIBRARY_DIR ${CAPU_LIBRARY_DIR}) SET(LIBCAPU_BINARY_DIR ${CAPU_BINARY_DIR}) ENDIF() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(LibCapu DEFAULT_MSG LIBCAPU_LIBRARY_DIR LIBCAPU_INCLUDE_DIR) mark_as_advanced(LIBCAPU_INCLUDE_DIR LIBCAPU_LIBRARY_DIR )