From 7d5b17d5c9ad280d6c53c6db78b6b24aaa3d11b3 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 14 Aug 2022 14:53:27 +0200 Subject: [PATCH] build: Added option to use NFD system library --- lib/libimhex/CMakeLists.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/libimhex/CMakeLists.txt b/lib/libimhex/CMakeLists.txt index d8b43fb7a..7b438823b 100644 --- a/lib/libimhex/CMakeLists.txt +++ b/lib/libimhex/CMakeLists.txt @@ -10,10 +10,6 @@ set_target_properties(imgui PROPERTIES POSITION_INDEPENDENT_CODE ON) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/microtar ${CMAKE_CURRENT_BINARY_DIR}/external/microtar EXCLUDE_FROM_ALL) set_target_properties(microtar PROPERTIES POSITION_INDEPENDENT_CODE ON) -set(NFD_PORTAL ON CACHE BOOL "Use Portals for Linux file dialogs" FORCE) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/nativefiledialog ${CMAKE_CURRENT_BINARY_DIR}/external/nativefiledialog EXCLUDE_FROM_ALL) -set_target_properties(nfd PROPERTIES POSITION_INDEPENDENT_CODE ON) - set(LIBROMFS_RESOURCE_LOCATION ${IMHEX_BASE_FOLDER}/resources/romfs) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/libromfs ${CMAKE_CURRENT_BINARY_DIR}/external/libromfs EXCLUDE_FROM_ALL) set_target_properties(libromfs PROPERTIES POSITION_INDEPENDENT_CODE ON) @@ -29,6 +25,16 @@ set(FPHSA_NAME_MISMATCHED ON CACHE BOOL "") # Find packages find_package(PkgConfig REQUIRED) +if (NOT USE_SYSTEM_NFD) + set(NFD_PORTAL ON CACHE BOOL "Use Portals for Linux file dialogs" FORCE) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/nativefiledialog ${CMAKE_CURRENT_BINARY_DIR}/external/nativefiledialog EXCLUDE_FROM_ALL) + set_target_properties(nfd PROPERTIES POSITION_INDEPENDENT_CODE ON) + set(NFD_LIBRARIES nfd) +else() + find_package(nfd) + set(NFD_LIBRARIES nfd) +endif() + if(NOT USE_SYSTEM_NLOHMANN_JSON) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/nlohmann_json ${CMAKE_CURRENT_BINARY_DIR}/external/nlohmann_json EXCLUDE_FROM_ALL) set(NLOHMANN_JSON_LIBRARIES nlohmann_json) @@ -166,4 +172,4 @@ if (APPLE) target_link_libraries(libimhex PUBLIC ${FOUNDATION}) endif () -target_link_libraries(libimhex PUBLIC dl imgui nfd magic ${CAPSTONE_LIBRARIES} LLVMDemangle microtar ${NLOHMANN_JSON_LIBRARIES} ${YARA_LIBRARIES} ${LIBCURL_LIBRARIES} ${MBEDTLS_LIBRARIES} ${FMT_LIBRARIES} ${Python_LIBRARIES} libromfs libpl intervaltree) +target_link_libraries(libimhex PUBLIC dl imgui ${NFD_LIBRARIES} magic ${CAPSTONE_LIBRARIES} LLVMDemangle microtar ${NLOHMANN_JSON_LIBRARIES} ${YARA_LIBRARIES} ${LIBCURL_LIBRARIES} ${MBEDTLS_LIBRARIES} ${FMT_LIBRARIES} ${Python_LIBRARIES} libromfs libpl intervaltree)