Warning, /kdevelop/kdevelop/cmake/modules/FindLibAStyle.cmake is written in an unsupported language. File is not indexed.
0001 # - Find LibAStyle 0002 # Find the Artistic Style library. 0003 # 0004 # This module defines 0005 # LibAStyle_FOUND - whether the astyle library was found 0006 # LibAStyle_LIBRARIES - the astyle library 0007 # LibAStyle_INCLUDE_DIR - the include path of the astyle library 0008 # LibAStyle_CFLAGS - the compiler flags needed when building with the astyle library 0009 0010 #============================================================================= 0011 # SPDX-FileCopyrightText: 2018-2019 Pino Toscano <pino@kde.org> 0012 # 0013 # SPDX-License-Identifier: BSD-3-Clause 0014 #============================================================================= 0015 0016 find_library(LibAStyle_LIBRARIES 0017 NAMES astyle 0018 ) 0019 0020 find_path(LibAStyle_INCLUDE_DIR 0021 NAMES astyle.h 0022 ) 0023 0024 # astyle is built without RTTI 0025 set(LibAStyle_CFLAGS "-fno-rtti") 0026 0027 if(LibAStyle_LIBRARIES AND LibAStyle_INCLUDE_DIR) 0028 include(CMakePushCheckState) 0029 include(CheckCXXSourceCompiles) 0030 cmake_push_check_state(RESET) 0031 set(CMAKE_REQUIRED_FLAGS "${LibAStyle_CFLAGS}") 0032 set(CMAKE_REQUIRED_LIBRARIES "${LibAStyle_LIBRARIES}") 0033 set(CMAKE_REQUIRED_INCLUDES "${LibAStyle_INCLUDE_DIR}") 0034 check_cxx_source_compiles(" 0035 #include <astyle.h> 0036 int main() 0037 { 0038 astyle::ASPeekStream foo(nullptr); 0039 return 0; 0040 }" LIBASTYLE_HAS_ASPEEKSTREAM) 0041 if(LIBASTYLE_HAS_ASPEEKSTREAM) 0042 set(_libastyle_version "3.1") 0043 message(STATUS "LibAStyle version autodetected as ${_libastyle_version} or greater") 0044 else() 0045 set(_libastyle_version "0") 0046 endif() 0047 cmake_pop_check_state() 0048 endif() 0049 0050 include(FindPackageHandleStandardArgs) 0051 find_package_handle_standard_args(LibAStyle 0052 FOUND_VAR LibAStyle_FOUND 0053 REQUIRED_VARS LibAStyle_LIBRARIES LibAStyle_INCLUDE_DIR 0054 VERSION_VAR _libastyle_version 0055 ) 0056 0057 mark_as_advanced(LibAStyle_INCLUDE_DIR LibAStyle_LIBRARIES) 0058 0059 if(LibAStyle_FOUND) 0060 add_library(astylelib UNKNOWN IMPORTED) 0061 set_target_properties(astylelib PROPERTIES 0062 INTERFACE_INCLUDE_DIRECTORIES "${LibAStyle_INCLUDE_DIR}" 0063 IMPORTED_LOCATION "${LibAStyle_LIBRARIES}" 0064 INTERFACE_COMPILE_OPTIONS "${LibAStyle_CFLAGS}" 0065 ) 0066 endif()