31 lines
965 B
CMake
31 lines
965 B
CMake
cmake_minimum_required(VERSION 3.18..3.28)
|
|
project(FunctionHook)
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
file(GLOB_RECURSE HEADERS "include/*.h")
|
|
|
|
#TODO more architectures.
|
|
if (UNIX AND NOT APPLE)
|
|
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
|
|
file(GLOB_RECURSE SOURCES "src/linux64/*.cpp" "src/linuxCommon/*.cpp")
|
|
endif()
|
|
|
|
if (CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64")
|
|
file(GLOB_RECURSE SOURCES "src/linuxRV64/*.cpp" "src/linuxCommon/*.cpp")
|
|
endif()
|
|
|
|
add_library(FunctionHook SHARED ${SOURCES})
|
|
endif()
|
|
|
|
if (WIN32)
|
|
file(GLOB_RECURSE SOURCES "src/windows/*.cpp")
|
|
add_library(FunctionHook STATIC ${SOURCES})
|
|
endif()
|
|
|
|
target_include_directories(FunctionHook PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
|
|
|
add_executable(FunctionHookDemo main.cpp)
|
|
target_link_libraries(FunctionHookDemo PUBLIC FunctionHook)
|
|
|
|
set_target_properties(FunctionHook PROPERTIES LINKER_LANGUAGE CXX)
|
|
set_target_properties(FunctionHookDemo PROPERTIES LINKER_LANGUAGE CXX) |