aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/syntax-highlighting/src/indexer/CMakeLists.txt
blob: 9fa26b27cefd6b67fdc14493dce2a7d4ce2469a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# when cross compiling, use either the executable offered or try to cross-compile it in place

if(CMAKE_CROSSCOMPILING AND KATEHIGHLIGHTINGINDEXER_EXECUTABLE)
    add_executable(katehighlightingindexer IMPORTED GLOBAL)
    set_target_properties(katehighlightingindexer PROPERTIES IMPORTED_LOCATION ${KATEHIGHLIGHTINGINDEXER_EXECUTABLE})
elseif(CMAKE_CROSSCOMPILING)
    if (NOT KF5_HOST_TOOLING)
        message(FATAL_ERROR "Please provide a prefix with a native Qt build and pass -DKF5_HOST_TOOLING=path")
    endif()

    # search native tooling prefix
    string(FIND ${KF5_HOST_TOOLING} /lib idx)
    string(SUBSTRING ${KF5_HOST_TOOLING} 0 ${idx} NATIVE_PREFIX)
    message(STATUS "Building katehighlightingindexer against ${NATIVE_PREFIX}")

    include(ExternalProject)
    ExternalProject_Add(native_katehighlightingindexer
                        SOURCE_DIR ${CMAKE_SOURCE_DIR}
                        CMAKE_ARGS -DKSYNTAXHIGHLIGHTING_USE_GUI=OFF
                            -DECM_DIR=${ECM_DIR} -DCMAKE_PREFIX_PATH=${NATIVE_PREFIX}
                            -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}
                        INSTALL_COMMAND ""
                    )
    add_executable(katehighlightingindexer IMPORTED GLOBAL)
    add_dependencies(katehighlightingindexer native_katehighlightingindexer)
    set_target_properties(katehighlightingindexer PROPERTIES IMPORTED_LOCATION
        ${CMAKE_CURRENT_BINARY_DIR}/native_katehighlightingindexer-prefix/src/native_katehighlightingindexer-build/bin/katehighlightingindexer)
else()
    # host build
    add_executable(katehighlightingindexer katehighlightingindexer.cpp)
    if(Qt5XmlPatterns_FOUND)
        target_link_libraries(katehighlightingindexer Qt5::XmlPatterns)
    else()
        target_link_libraries(katehighlightingindexer Qt5::Core)
    endif()
endif()