diff --git a/development/cmake/CMakeLists.txt b/development/cmake/CMakeLists.txt index f910ac3ce8..eb4182332d 100644 --- a/development/cmake/CMakeLists.txt +++ b/development/cmake/CMakeLists.txt @@ -373,9 +373,14 @@ else() include(ConfigureChecks.cmake) configure_file(configCompiler.h.cmake ${CMAKE_BINARY_DIR}/configCompiler.h) endif() +find_package(AiksaurusLIB) +if(AIKSAURUSLIB_FOUND) + # Variables in config.h will be set correctly with configure_file() + set(HAVE_LIBAIKSAURUS 1) + set(AIKSAURUS_H_LOCATION 1) +endif() configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h) - find_package(ICONV REQUIRED) add_definitions(-DHAVE_ICONV=1) diff --git a/development/cmake/config.h.cmake b/development/cmake/config.h.cmake index 51ab14d530..e0d1f8f9fd 100644 --- a/development/cmake/config.h.cmake +++ b/development/cmake/config.h.cmake @@ -41,5 +41,7 @@ #cmakedefine USE_MACOSX_PACKAGING 1 #cmakedefine PATH_MAX ${PATH_MAX} +#cmakedefine HAVE_LIBAIKSAURUS 1 +#cmakedefine AIKSAURUS_H_LOCATION <${AIKSAURUS_H}> #endif diff --git a/development/cmake/modules/FindAiksaurusLIB.cmake b/development/cmake/modules/FindAiksaurusLIB.cmake new file mode 100644 index 0000000000..29fe2d0e7f --- /dev/null +++ b/development/cmake/modules/FindAiksaurusLIB.cmake @@ -0,0 +1,44 @@ +# +# based on FindZLIB.cmake +# created 2009, Kornel Benko, +# + +set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) + +if (AIKSAURUS_INCLUDE_DIR) + # Already in cache, be silent + set(AIKSAURUS_FIND_QUIETLY TRUE) +endif() + +find_path(AIKSAURUS_INCLUDE_DIR NAMES Aiksaurus.h + PATH_SUFFIXES "" "Aiksaurus") +if(AIKSAURUS_INCLUDE_DIR) + if(AIKSAURUS_INCLUDE_DIR MATCHES "Aiksaurus") + set(AIKSAURUS_H Aiksaurus/Aiksaurus.h) + else() + set(AIKSAURUS_H Aiksaurus.h) + endif() +endif() + +set(POTENTIAL_AIKSAURUS_LIBS Aiksaurus) + +find_library(AIKSAURUSLIB_LIBRARY NAMES ${POTENTIAL_AIKSAURUS_LIBS} + PATHS + /usr/lib /usr/local/lib) + +if(AIKSAURUS_INCLUDE_DIR AND AIKSAURUSLIB_LIBRARY) + set(AIKSAURUSLIB_FOUND TRUE) +endif() + +if(AIKSAURUSLIB_FOUND) + if(NOT AIKSAURUS_FIND_QUIETLY) + message(STATUS "Found AIKSAURUS: ${AIKSAURUSLIB_LIBRARY}") + endif() +else() + if(AIKSAURUS_FIND_REQUIRED) + message(STATUS "Looked for AIKSAURUS libraries named ${POTENTIAL_AIKSAURUS_LIBS}.") + message(STATUS "Found no acceptable AIKSAURUS library. This is fatal.") + endif() +endif() + +mark_as_advanced(AIKSAURUSLIB_LIBRARY AIKSAURUSLIB_INCLUDE_DIR) diff --git a/development/cmake/src/CMakeLists.txt b/development/cmake/src/CMakeLists.txt index 763755f170..6db9f1d1e8 100644 --- a/development/cmake/src/CMakeLists.txt +++ b/development/cmake/src/CMakeLists.txt @@ -85,6 +85,9 @@ if (MINGW) target_link_libraries(${_lyx} ole32) endif() +if (AIKSAURUSLIB_LIBRARY) + target_link_libraries(${_lyx} ${AIKSAURUSLIB_LIBRARY}) +endif() project_source_group("${GROUP_CODE}" lyx_sources lyx_headers) install(TARGETS ${_lyx} DESTINATION bin)