mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-28 00:21:48 +03:00
Introduce "Dev mode" option
When the option is On, CMake will have rules to generate the generated files using scripts etc. When the option is Off, CMake will assume the files are available from the source tree; in that mode, it won't require any extra tools (Perl for example) compared to when we committed the files to git. The intention is that users will never need to adjust this option: - in the development branch (and features branches etc.) the option is always On (development mode); - in released tarballs, which include the generated files, we'll switch the option to Off (release mode) in the same commit that re-adds the generated files. Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
committed by
David Horstmann
parent
313bcfcde8
commit
e90e405e15
@ -109,38 +109,43 @@ set(src_tls
|
||||
ssl_tls13_generic.c
|
||||
)
|
||||
|
||||
find_package(Perl REQUIRED)
|
||||
if(DEV_MODE)
|
||||
find_package(Perl REQUIRED)
|
||||
|
||||
file(GLOB error_headers ${CMAKE_CURRENT_SOURCE_DIR}/../include/mbedtls/*.h)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${CMAKE_CURRENT_BINARY_DIR}/error.c
|
||||
COMMAND
|
||||
${PERL_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_errors.pl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include/mbedtls
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files
|
||||
file(GLOB error_headers ${CMAKE_CURRENT_SOURCE_DIR}/../include/mbedtls/*.h)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${CMAKE_CURRENT_BINARY_DIR}/error.c
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_errors.pl
|
||||
${error_headers}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files/error.fmt
|
||||
)
|
||||
COMMAND
|
||||
${PERL_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_errors.pl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include/mbedtls
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files
|
||||
${CMAKE_CURRENT_BINARY_DIR}/error.c
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_errors.pl
|
||||
${error_headers}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files/error.fmt
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version_features.c
|
||||
COMMAND
|
||||
${PERL_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_features.pl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include/mbedtls
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version_features.c
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_features.pl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include/mbedtls/mbedtls_config.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files/version_features.fmt
|
||||
)
|
||||
COMMAND
|
||||
${PERL_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_features.pl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include/mbedtls
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version_features.c
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_features.pl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include/mbedtls/mbedtls_config.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files/version_features.fmt
|
||||
)
|
||||
else()
|
||||
link_to_source(error.c)
|
||||
link_to_source(version_features.c)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-declarations -Wmissing-prototypes")
|
||||
|
Reference in New Issue
Block a user