x-tools/xapps/xhash/xHash.cmake
2025-08-07 13:17:15 +08:00

42 lines
1.5 KiB
CMake

file(GLOB_RECURSE X_FILES "${CMAKE_SOURCE_DIR}/xapps/x/*.*")
file(GLOB_RECURSE COMMON_FILES "${CMAKE_SOURCE_DIR}/src/common/*.*")
file(GLOB_RECURSE TOOLS_FILES "${CMAKE_SOURCE_DIR}/src/tools/filecheck/*.*")
file(GLOB_RECURSE X_HASH_FILES "${CMAKE_CURRENT_LIST_DIR}/src/*.*")
set(PRO_FILES ${CMAKE_CURRENT_LIST_DIR}/xHash.rc)
list(APPEND PRO_FILES ${CMAKE_CURRENT_LIST_DIR}/xHash.qrc)
list(APPEND PRO_FILES ${X_FILES})
list(APPEND PRO_FILES ${COMMON_FILES})
list(APPEND PRO_FILES ${TOOLS_FILES})
list(APPEND PRO_FILES ${X_HASH_FILES})
file(GLOB LUA_FILES "${CMAKE_SOURCE_DIR}/src/common/luarunner.*")
# Remove Lua files from the list if they exist
foreach(LUA_FILE ${LUA_FILES})
if(EXISTS ${LUA_FILE})
list(REMOVE_ITEM PRO_FILES ${LUA_FILE})
endif()
endforeach()
include_directories(${CMAKE_SOURCE_DIR}/xapps)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${X_BINS_DIR}/xHash)
qt_add_executable(xHash ${PRO_FILES})
x_deploy_qt(xHash)
x_generate_translations(xHash)
target_link_libraries(xHash PRIVATE Qt6::Core Qt6::Gui Qt6::Svg Qt6::Widgets Qt6::Network)
target_link_libraries(xHash PRIVATE Qt6::SerialPort)
if(X_USING_VS_CODE)
set_target_properties(xHash PROPERTIES MACOSX_BUNDLE TRUE)
else()
set_target_properties(xHash PROPERTIES MACOSX_BUNDLE TRUE WIN32_EXECUTABLE TRUE)
endif()
if(DEFINED X_ICONV_LIBS)
target_link_libraries(xHash PRIVATE ${X_ICONV_LIBS})
endif()
if(WIN32)
target_link_libraries(xHash PRIVATE Dwmapi)
elseif(LINUX)
target_link_libraries(xHash PRIVATE dl)
endif()