cmake_minimum_required(VERSION 3.20) project(LauncherHook LANGUAGES CXX) # Force x86 (32-bit) build if(NOT CMAKE_SIZEOF_VOID_P EQUAL 4) message(WARNING "LauncherHook.DLL must be built as x86 (32-bit). Use -A Win32 with Visual Studio generator.") endif() add_library(LauncherHook SHARED LauncherHook.cpp LauncherHook.def ) target_compile_definitions(LauncherHook PRIVATE WIN32 _WINDOWS _USRDLL UNICODE _UNICODE ) target_link_libraries(LauncherHook PRIVATE advapi32 user32 kernel32 ) # MSVC-specific settings if(MSVC) target_compile_options(LauncherHook PRIVATE /W3 /GR- /EHsc) set_target_properties(LauncherHook PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL" ) endif() set_target_properties(LauncherHook PROPERTIES OUTPUT_NAME "LauncherHook" SUFFIX ".DLL" )