cmake_minimum_required(VERSION 3.25) project(WLocate VERSION 1.0.0 LANGUAGES C CXX RC) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") add_compile_definitions(UNICODE _UNICODE NOMINMAX WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x0A00) add_compile_options(/W4 /utf-8 $<$:/permissive-> $<$:/EHsc> $<$:/O2>) set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) set(PCRE2_BUILD_PCRE2_8 ON CACHE BOOL "" FORCE) set(PCRE2_BUILD_PCRE2_16 OFF CACHE BOOL "" FORCE) set(PCRE2_BUILD_PCRE2_32 OFF CACHE BOOL "" FORCE) set(PCRE2_BUILD_TESTS OFF CACHE BOOL "" FORCE) set(PCRE2_BUILD_PCRE2GREP OFF CACHE BOOL "" FORCE) set(PCRE2_SUPPORT_JIT ON CACHE BOOL "" FORCE) add_subdirectory(third_party/pcre2 EXCLUDE_FROM_ALL) add_library(wlocate_core STATIC src/common.cpp src/query.cpp src/regex.cpp src/index.cpp src/ntfs.cpp src/ntfs_parser.cpp src/store.cpp src/ipc.cpp) target_include_directories(wlocate_core PUBLIC include) target_link_libraries(wlocate_core PUBLIC advapi32 shell32 ole32 shlwapi bcrypt pcre2-8-static) add_executable(wlocate WIN32 src/main.cpp src/service.cpp src/gui.cpp src/shell.cpp src/app.rc) target_link_options(wlocate PRIVATE /MANIFEST:NO) target_link_libraries(wlocate PRIVATE wlocate_core comctl32 comdlg32 oleaut32 uuid uxtheme) target_link_libraries(wlocate PRIVATE windowscodecs) add_executable(locate src/cli.cpp src/app.rc) target_link_options(locate PRIVATE /MANIFEST:NO) target_link_libraries(locate PRIVATE wlocate_core) add_executable(wlocate_tests tests/tests.cpp src/app.rc) target_link_options(wlocate_tests PRIVATE /MANIFEST:NO) target_link_libraries(wlocate_tests PRIVATE wlocate_core) enable_testing() add_test(NAME core COMMAND wlocate_tests) add_executable(wlocate_ui_tests WIN32 tests/ui_tests.cpp src/gui.cpp src/shell.cpp src/app.rc) target_link_options(wlocate_ui_tests PRIVATE /MANIFEST:NO) target_link_libraries(wlocate_ui_tests PRIVATE wlocate_core comctl32 comdlg32 oleaut32 uuid uxtheme windowscodecs) add_executable(wlocate_gui_cache_tests tests/gui_cache_tests.cpp src/shell.cpp src/app.rc) target_link_options(wlocate_gui_cache_tests PRIVATE /MANIFEST:NO) target_link_libraries(wlocate_gui_cache_tests PRIVATE wlocate_core comctl32 comdlg32 oleaut32 uuid uxtheme windowscodecs) add_test(NAME gui_cache COMMAND wlocate_gui_cache_tests) add_executable(wlocate_icon_cache_tests tests/icon_cache_tests.cpp src/app.rc) target_link_options(wlocate_icon_cache_tests PRIVATE /MANIFEST:NO) target_link_libraries(wlocate_icon_cache_tests PRIVATE wlocate_core comctl32) add_test(NAME icon_cache COMMAND wlocate_icon_cache_tests) add_executable(wlocate_hotkey_tests tests/gui_hotkey_tests.cpp src/shell.cpp src/app.rc) target_link_options(wlocate_hotkey_tests PRIVATE /MANIFEST:NO) target_link_libraries(wlocate_hotkey_tests PRIVATE wlocate_core comctl32 comdlg32 oleaut32 uuid uxtheme windowscodecs) add_test(NAME hotkey COMMAND wlocate_hotkey_tests) foreach(gui_target wlocate wlocate_ui_tests wlocate_gui_cache_tests wlocate_hotkey_tests) target_link_libraries(${gui_target} PRIVATE uiautomationcore) endforeach() set_target_properties(wlocate locate PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")