Use a tag to exclude targets on Windows when building with CMake
PiperOrigin-RevId: 508006914
diff --git a/cmake/TinkBuildRules.cmake b/cmake/TinkBuildRules.cmake
index b97c24c..d64e7ac 100644
--- a/cmake/TinkBuildRules.cmake
+++ b/cmake/TinkBuildRules.cmake
@@ -54,6 +54,7 @@
set(TINK_IDE_FOLDER "Tink")
set(TINK_TARGET_EXCLUDE_IF_OPENSSL "exclude_if_openssl")
+set(TINK_TARGET_EXCLUDE_IF_WINDOWS "exclude_if_windows")
# Declare the beginning of a new Tink library namespace.
#
@@ -104,12 +105,16 @@
"TINK_MODULE not defined, perhaps you are missing a tink_module() statement?")
endif()
- # Check if this target must be skipped. Currently the only reason for this to
- # happen is incompatibility with OpenSSL, when used.
+ # Check if this target must be skipped.
foreach(_tink_cc_library_tag ${tink_cc_library_TAGS})
+ # Exclude if we use OpenSSL.
if (${_tink_cc_library_tag} STREQUAL ${TINK_TARGET_EXCLUDE_IF_OPENSSL} AND TINK_USE_SYSTEM_OPENSSL)
return()
endif()
+ # Exclude if building on Windows.
+ if (${_tink_cc_library_tag} STREQUAL ${TINK_TARGET_EXCLUDE_IF_WINDOWS} AND WIN32)
+ return()
+ endif()
endforeach()
# We replace :: with __ in targets, because :: may not appear in target names.
@@ -180,12 +185,16 @@
message(FATAL_ERROR "TINK_MODULE not defined")
endif()
- # Check if this target must be skipped. Currently the only reason for this to
- # happen is incompatibility with OpenSSL, when used.
+ # Check if this target must be skipped.
foreach(_tink_cc_test_tag ${tink_cc_test_TAGS})
+ # Exclude if we use OpenSSL.
if (${_tink_cc_test_tag} STREQUAL ${TINK_TARGET_EXCLUDE_IF_OPENSSL} AND TINK_USE_SYSTEM_OPENSSL)
return()
endif()
+ # Exclude if building on Windows.
+ if (${_tink_cc_test_tag} STREQUAL ${TINK_TARGET_EXCLUDE_IF_WINDOWS} AND WIN32)
+ return()
+ endif()
endforeach()
# We replace :: with __ in targets, because :: may not appear in target names.