Allow building with -DCRYFS_UPDATE_CHECKS=off, which will create an executable with disabled update checks (the alternative to disable them in the environment also still works).

This commit is contained in:
Sebastian Messmer 2016-09-24 13:16:26 +02:00
parent 1c34c88709
commit 11a85ed29f
6 changed files with 19 additions and 1 deletions

View File

@ -9,7 +9,7 @@ require_clang_version(3.7)
# Default value is not to build test cases # Default value is not to build test cases
if(NOT BUILD_TESTING) if(NOT BUILD_TESTING)
set(BUILD_TESTING OFF CACHE INTERNAL "BUILD_TESTING") set(BUILD_TESTING OFF CACHE BOOL "BUILD_TESTING")
endif(NOT BUILD_TESTING) endif(NOT BUILD_TESTING)
# Default vaule is to build in release mode # Default vaule is to build in release mode
@ -17,6 +17,11 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE INTERNAL "CMAKE_BUILD_TYPE") set(CMAKE_BUILD_TYPE Release CACHE INTERNAL "CMAKE_BUILD_TYPE")
endif(NOT CMAKE_BUILD_TYPE) endif(NOT CMAKE_BUILD_TYPE)
# Default value is to do update checks
if(NOT CRYFS_UPDATE_CHECKS)
set(CRYFS_UPDATE_CHECKS ON CACHE BOOL "CRYFS_UPDATE_CHECKS")
endif(NOT CRYFS_UPDATE_CHECKS)
add_subdirectory(vendor) add_subdirectory(vendor)
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(test) add_subdirectory(test)

View File

@ -3,6 +3,9 @@ Version 0.9.6 (unreleased)
Fixed bugs: Fixed bugs:
* Fix potential (although very improbable) deadlock * Fix potential (although very improbable) deadlock
Improvements:
* Allow building with -DCRYFS_UPDATE_CHECKS=off, which will create an executable with disabled update checks (the alternative to disable them in the environment also still works).
Compatibility: Compatibility:
* Compatible with libcurl version >= 7.50.0, and <= 7.21.6 (tested down to 7.19.0) * Compatible with libcurl version >= 7.50.0, and <= 7.21.6 (tested down to 7.19.0)
* Compatible with Crypto++ 5.6.4 * Compatible with Crypto++ 5.6.4

View File

@ -92,6 +92,7 @@ Build & Install
You can pass the following variables to the *cmake* command (using *-Dvariablename=value*): You can pass the following variables to the *cmake* command (using *-Dvariablename=value*):
- -D**CMAKE_BUILD_TYPE**=[Release|Debug]: Whether to run code optimization or add debug symbols. Default: Release - -D**CMAKE_BUILD_TYPE**=[Release|Debug]: Whether to run code optimization or add debug symbols. Default: Release
- -D**BUILD_TESTING**=[on|off]: Whether to build the test cases (can take a long time). Default: off - -D**BUILD_TESTING**=[on|off]: Whether to build the test cases (can take a long time). Default: off
- -D**CRYFS_UPDATE_CHECKS**=off: Build a CryFS that doesn't check online for updates and security vulnerabilities.
Troubleshooting Troubleshooting
--------------- ---------------

View File

@ -15,6 +15,10 @@ target_link_libraries(${PROJECT_NAME} PUBLIC cryfs cpp-utils gitversion)
target_enable_style_warnings(${PROJECT_NAME}) target_enable_style_warnings(${PROJECT_NAME})
target_activate_cpp14(${PROJECT_NAME}) target_activate_cpp14(${PROJECT_NAME})
if(NOT CRYFS_UPDATE_CHECKS)
target_compile_definitions(${PROJECT_NAME} PRIVATE -DCRYFS_NO_UPDATE_CHECKS)
endif(NOT CRYFS_UPDATE_CHECKS)
add_executable(${PROJECT_NAME}_bin main.cpp) add_executable(${PROJECT_NAME}_bin main.cpp)
set_target_properties(${PROJECT_NAME}_bin PROPERTIES OUTPUT_NAME cryfs) set_target_properties(${PROJECT_NAME}_bin PROPERTIES OUTPUT_NAME cryfs)
target_link_libraries(${PROJECT_NAME}_bin PUBLIC ${PROJECT_NAME}) target_link_libraries(${PROJECT_NAME}_bin PUBLIC ${PROJECT_NAME})

View File

@ -90,11 +90,15 @@ namespace cryfs {
#ifndef NDEBUG #ifndef NDEBUG
cout << "WARNING! This is a debug build. Performance might be slow." << endl; cout << "WARNING! This is a debug build. Performance might be slow." << endl;
#endif #endif
#ifndef CRYFS_NO_UPDATE_CHECKS
if (!Environment::noUpdateCheck()) { if (!Environment::noUpdateCheck()) {
_checkForUpdates(); _checkForUpdates();
} else { } else {
cout << "Automatic checking for security vulnerabilities and updates is disabled." << endl; cout << "Automatic checking for security vulnerabilities and updates is disabled." << endl;
} }
#else
# warning Update checks are disabled. The resulting executable will not go online to check for newer versions or known security vulnerabilities.
#endif
cout << endl; cout << endl;
} }

View File

@ -19,3 +19,4 @@ add_test(${PROJECT_NAME} ${PROJECT_NAME})
target_enable_style_warnings(${PROJECT_NAME}) target_enable_style_warnings(${PROJECT_NAME})
target_activate_cpp14(${PROJECT_NAME}) target_activate_cpp14(${PROJECT_NAME})