diff --git a/CMakeLists.txt b/CMakeLists.txt index ee16991..4807db5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ option(SAFETYHOOK_BUILD_TEST "" OFF) option(SAFETYHOOK_BUILD_EXAMPLES "" OFF) option(SAFETYHOOK_AMALGAMATE "" OFF) option(SAFETYHOOK_FETCH_ZYDIS "" OFF) +option(SAFETYHOOK_USE_CXXMODULES "" OFF) project(safetyhook) @@ -146,6 +147,11 @@ target_link_libraries(safetyhook PUBLIC Zydis ) +set(CMKR_TARGET safetyhook) +if(SAFETYHOOK_USE_CXXMODULES) + target_compile_definitions(safetyhook INTERFACE SAFETYHOOK_USE_CXXMODULES) +endif() + # Target: docs if(SAFETYHOOK_BUILD_DOCS) # build-docs set(CMKR_TARGET docs) diff --git a/cmake.toml b/cmake.toml index e5c79fa..70abb24 100644 --- a/cmake.toml +++ b/cmake.toml @@ -8,6 +8,7 @@ SAFETYHOOK_BUILD_TEST = false SAFETYHOOK_BUILD_EXAMPLES = false SAFETYHOOK_AMALGAMATE = false SAFETYHOOK_FETCH_ZYDIS = false +SAFETYHOOK_USE_CXXMODULES = false [conditions] build-docs = "SAFETYHOOK_BUILD_DOCS" @@ -59,6 +60,11 @@ link-libraries = ["Zydis"] msvc.private-compile-options = ["/permissive-", "/W4", "/w14640"] clang.private-compile-options = ["-Wall", "-Wextra", "-Wshadow", "-Wnon-virtual-dtor", "-pedantic"] gcc.private-compile-options = ["-Wall", "-Wextra", "-Wshadow", "-Wnon-virtual-dtor", "-pedantic"] +cmake-after = """ +if(SAFETYHOOK_USE_CXXMODULES) + target_compile_definitions(safetyhook INTERFACE SAFETYHOOK_USE_CXXMODULES) +endif() +""" [target.docs] condition = "build-docs"