mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Cmake build: Symplify use of linking optional libraries found via find_package
This commit is contained in:
parent
e67e37d759
commit
3b14de740d
@ -55,22 +55,8 @@ find_library(Magic_LIBRARY NAMES "magic")
|
|||||||
|
|
||||||
check_magic_functions_exists(HAS_MAGIC_FUNCTIONS)
|
check_magic_functions_exists(HAS_MAGIC_FUNCTIONS)
|
||||||
|
|
||||||
if(Magic_INCLUDE_DIR AND Magic_LIBRARY AND HAS_MAGIC_FUNCTIONS)
|
# handle the QUIET and REQUIRED arguments and DEFAULT_MSG
|
||||||
set(Magic_FOUND TRUE)
|
# set Magic_FOUND to TRUE if all listed variables are TRUE
|
||||||
endif()
|
|
||||||
|
|
||||||
if(Magic_FOUND)
|
include(FindPackageHandleStandardArgs)
|
||||||
if(NOT Magic_FIND_QUIETLY)
|
find_package_handle_standard_args(Magic DEFAULT_MSG Magic_INCLUDE_DIR Magic_LIBRARY HAS_MAGIC_FUNCTIONS)
|
||||||
message(STATUS "Found magic library: ${Magic_LIBRARY}")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
if(Magic_FIND_REQUIRED)
|
|
||||||
message(STATUS "Looked for magic library named magic.")
|
|
||||||
message(STATUS "Found no acceptable magic library. This is fatal.")
|
|
||||||
message(STATUS "magic header: ${Magic_INCLUDE_DIR}")
|
|
||||||
message(STATUS "magic lib : ${Magic_LIBRARY}")
|
|
||||||
message(FATAL_ERROR "Could NOT find magic library")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
mark_as_advanced(Magic_LIBRARY Magic_INCLUDE_DIR)
|
|
||||||
|
@ -329,3 +329,14 @@ macro(setmarkedtestlabel testname reverted)
|
|||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
macro(lyx_target_link_libraries _target)
|
||||||
|
foreach(_lib ${ARGN})
|
||||||
|
string(TOUPPER ${_lib} _ulib)
|
||||||
|
if(${_ulib}_FOUND)
|
||||||
|
#message(STATUS "target_link_libraries(${_target} ${${_lib}_LIBRARY})")
|
||||||
|
target_link_libraries(${_target} ${${_lib}_LIBRARY})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
@ -134,18 +134,7 @@ target_link_libraries(${_lyx}
|
|||||||
${QT_QTMAIN_LIBRARY}
|
${QT_QTMAIN_LIBRARY}
|
||||||
${vld_dll})
|
${vld_dll})
|
||||||
|
|
||||||
if(HUNSPELL_FOUND)
|
lyx_target_link_libraries(${_lyx} HUNSPELL ASPELL ENCHANT Magic)
|
||||||
target_link_libraries(${_lyx} ${HUNSPELL_LIBRARY})
|
|
||||||
endif()
|
|
||||||
if(ASPELL_FOUND)
|
|
||||||
target_link_libraries(${_lyx} ${ASPELL_LIBRARY})
|
|
||||||
endif()
|
|
||||||
if(ENCHANT_FOUND)
|
|
||||||
target_link_libraries(${_lyx} ${ENCHANT_LIBRARY})
|
|
||||||
endif()
|
|
||||||
if(Magic_FOUND)
|
|
||||||
target_link_libraries(${_lyx} ${Magic_LIBRARY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
target_link_libraries(${_lyx} "-bind_at_load")
|
target_link_libraries(${_lyx} "-bind_at_load")
|
||||||
|
@ -30,12 +30,9 @@ target_link_libraries(${_lyxclient}
|
|||||||
${Lyx_Boost_Libraries}
|
${Lyx_Boost_Libraries}
|
||||||
${ICONV_LIBRARY}
|
${ICONV_LIBRARY}
|
||||||
${QT_QTCORE_LIBRARY}
|
${QT_QTCORE_LIBRARY}
|
||||||
${QT_QTGUI_LIBRARY}
|
${QT_QTGUI_LIBRARY})
|
||||||
${Magic_LIBRARY})
|
|
||||||
|
|
||||||
if(ASPELL_FOUND)
|
lyx_target_link_libraries(${_lyxclient} Magic ASPELL)
|
||||||
target_link_libraries(${_lyxclient} ${ASPELL_LIBRARY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
target_link_libraries(${_lyxclient} "-framework AppKit")
|
target_link_libraries(${_lyxclient} "-framework AppKit")
|
||||||
|
@ -15,7 +15,8 @@ macro(sources _program)
|
|||||||
add_executable(${_program} ${_tmplist})
|
add_executable(${_program} ${_tmplist})
|
||||||
target_link_libraries(${_program} support
|
target_link_libraries(${_program} support
|
||||||
${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
|
${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
|
||||||
${ZLIB_LIBRARY} ${ICONV_LIBRARY} ${Magic_LIBRARY})
|
${ZLIB_LIBRARY} ${ICONV_LIBRARY})
|
||||||
|
lyx_target_link_libraries(${_program} Magic)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
file(GLOB test_sources ${TOP_SRC_DIR}/src/support/tests/${LYX_CPP_FILES})
|
file(GLOB test_sources ${TOP_SRC_DIR}/src/support/tests/${LYX_CPP_FILES})
|
||||||
|
@ -18,7 +18,8 @@ add_executable(check_layout ${check_layout_SOURCES})
|
|||||||
|
|
||||||
target_link_libraries(check_layout support
|
target_link_libraries(check_layout support
|
||||||
${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
|
${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
|
||||||
${ZLIB_LIBRARY} ${ICONV_LIBRARY} ${Magic_LIBRARY})
|
${ZLIB_LIBRARY} ${ICONV_LIBRARY})
|
||||||
|
lyx_target_link_libraries(check_layout Magic)
|
||||||
|
|
||||||
add_dependencies(lyx_run_tests check_layout)
|
add_dependencies(lyx_run_tests check_layout)
|
||||||
set_target_properties(check_layout PROPERTIES FOLDER "tests/src")
|
set_target_properties(check_layout PROPERTIES FOLDER "tests/src")
|
||||||
|
@ -48,8 +48,9 @@ target_link_libraries(${_tex2lyx}
|
|||||||
${Lyx_Boost_Libraries}
|
${Lyx_Boost_Libraries}
|
||||||
${QT_QTCORE_LIBRARY}
|
${QT_QTCORE_LIBRARY}
|
||||||
${QT_QTGUI_LIBRARY}
|
${QT_QTGUI_LIBRARY}
|
||||||
${ICONV_LIBRARY}
|
${ICONV_LIBRARY})
|
||||||
${Magic_LIBRARY})
|
|
||||||
|
lyx_target_link_libraries(${_tex2lyx} Magic)
|
||||||
|
|
||||||
add_dependencies(${_tex2lyx} lyx_version)
|
add_dependencies(${_tex2lyx} lyx_version)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user