mirror of
https://git.recroomarchive.org/Radium/libradhook.git
synced 2026-08-07 09:10:59 +00:00
initial commit
This commit is contained in:
90
CMakeLists.txt
Normal file
90
CMakeLists.txt
Normal file
@@ -0,0 +1,90 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
project(
|
||||
radhook
|
||||
VERSION 1.0.0
|
||||
DESCRIPTION "cross-platform function hooking library"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared library" ON)
|
||||
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
|
||||
add_library(radhook
|
||||
src/radhook.cpp
|
||||
)
|
||||
|
||||
target_include_directories(radhook
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
target_compile_features(radhook PUBLIC cxx_std_20)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(radhook PRIVATE RADHOOK_BUILD)
|
||||
target_compile_definitions(radhook INTERFACE RADHOOK_SHARED)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_compile_definitions(radhook PUBLIC RADIUM_PLATFORM_WINDOWS=1)
|
||||
elseif(ANDROID)
|
||||
target_compile_definitions(radhook PUBLIC RADIUM_PLATFORM_ANDROID=1)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(radhook PRIVATE
|
||||
/W4
|
||||
/permissive-
|
||||
)
|
||||
else()
|
||||
target_compile_options(radhook PRIVATE
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wpedantic
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_options(radhook PRIVATE
|
||||
$<$<CONFIG:Release>:
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/O2 /GL>
|
||||
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-O3 -fvisibility=hidden>
|
||||
>
|
||||
)
|
||||
|
||||
target_link_options(radhook PRIVATE
|
||||
$<$<CONFIG:Release>:
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/OPT:REF /OPT:ICF>
|
||||
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-s>
|
||||
>
|
||||
)
|
||||
|
||||
set_target_properties(radhook PROPERTIES
|
||||
CXX_VISIBILITY_PRESET hidden
|
||||
VISIBILITY_INLINES_HIDDEN YES
|
||||
)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
install(TARGETS radhook
|
||||
EXPORT radhookTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
install(
|
||||
FILES include/radhook.hpp
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
|
||||
install(
|
||||
EXPORT radhookTargets
|
||||
FILE radhookTargets.cmake
|
||||
NAMESPACE Radium::
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/radhook
|
||||
)
|
||||
Reference in New Issue
Block a user