Skip to content

Commit

Permalink
Move options definitions into the single place in the main CMakeLists…
Browse files Browse the repository at this point in the history
… file. Replace add_definitions() rule with target_compile_definitions() to follow cmake's best practices.

PiperOrigin-RevId: 446713577
LizaTretyakova authored and copybara-github committed May 5, 2022
1 parent 806e1b8 commit e2ba17a
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ option(TINK_USE_INSTALLED_ABSEIL "Build Tink linking to Abseil installed in the
option(TINK_USE_INSTALLED_GOOGLETEST "Build Tink linking to GTest installed in the system" OFF)
option(TINK_USE_ABSL_STATUS "Compile Tink with absl::Status" OFF)
option(TINK_USE_ABSL_STATUSOR "Compile Tink with absl::StatusOr" OFF)
option(USE_ONLY_FIPS "Enables the FIPS only mode in Tink" OFF)

set(CPACK_GENERATOR TGZ)
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
10 changes: 4 additions & 6 deletions cc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -14,21 +14,19 @@ add_subdirectory(util)

tink_module(core)

# Configuration settings for the build.

if (TINK_USE_ABSL_STATUS)
target_compile_definitions(tink_util_status PUBLIC TINK_USE_ABSL_STATUS)
endif()

if (TINK_USE_ABSL_STATUSOR)
target_compile_definitions(tink_util_statusor INTERFACE TINK_USE_ABSL_STATUSOR)
endif()

# configuration settings for the build
option(USE_ONLY_FIPS "Enables the FIPS only mode in Tink" OFF)
if(USE_ONLY_FIPS)
add_definitions(-DTINK_USE_ONLY_FIPS)
target_compile_definitions(tink_internal_fips_utils PUBLIC TINK_USE_ONLY_FIPS)
endif()

# public libraries
# Public libraries.

set(TINK_VERSION_H "${TINK_GENFILE_DIR}/tink/version.h")

0 comments on commit e2ba17a

Please sign in to comment.