Fix getdnsapi/stubby#295 set default build type to RelWithDebInfo

And expose CFLAGS through GETDNS_BUILD_CFLAGS define and via getdns_context_get_api_information()
This commit is contained in:
Willem Toorop 2022-08-11 16:15:30 +02:00
parent 0cb72000f8
commit 6b65aed443
3 changed files with 8 additions and 2 deletions

View File

@ -6,8 +6,8 @@ endif ()
# The following must be set BEFORE doing project() or enable_language(). # The following must be set BEFORE doing project() or enable_language().
if (NOT CMAKE_BUILD_TYPE) if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type defined; defaulting to 'Debug'") message(STATUS "No build type defined; defaulting to 'RelWithDebInfo'")
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"The type of build. Possible values are: Debug, Release, RelWithDebInfo and MinSizeRel.") "The type of build. Possible values are: Debug, Release, RelWithDebInfo and MinSizeRel.")
endif () endif ()
@ -1026,6 +1026,8 @@ if (BUILD_TESTING)
endif () endif ()
# Substitutions in files. # Substitutions in files.
string(TOUPPER "${CMAKE_BUILD_TYPE}" GETDNS_BUILD_RELTYPE)
string(REPLACE "\"" "\\\"" GETDNS_BUILD_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${GETDNS_BUILD_RELTYPE}}")
configure_file(cmake/include/cmakeconfig.h.in config.h) configure_file(cmake/include/cmakeconfig.h.in config.h)
configure_file(src/getdns/getdns.h.in getdns/getdns.h) configure_file(src/getdns/getdns.h.in getdns/getdns.h)
configure_file(src/getdns/getdns_extra.h.in getdns/getdns_extra.h) configure_file(src/getdns/getdns_extra.h.in getdns/getdns_extra.h)

View File

@ -4096,6 +4096,9 @@ getdns_context_get_api_information(const getdns_context* context)
&& ! getdns_dict_util_set_string( && ! getdns_dict_util_set_string(
result, "compilation_comment", GETDNS_COMPILATION_COMMENT) result, "compilation_comment", GETDNS_COMPILATION_COMMENT)
&& ! getdns_dict_util_set_string(
result, "build_cflags", GETDNS_BUILD_CFLAGS)
&& ! getdns_dict_util_set_string( && ! getdns_dict_util_set_string(
result, "default_trust_anchor_location", TRUST_ANCHOR_FILE) result, "default_trust_anchor_location", TRUST_ANCHOR_FILE)

View File

@ -128,6 +128,7 @@ extern "C" {
#define GETDNS_NUMERIC_VERSION @GETDNS_NUMERIC_VERSION@ #define GETDNS_NUMERIC_VERSION @GETDNS_NUMERIC_VERSION@
#define GETDNS_API_VERSION "@API_VERSION@" #define GETDNS_API_VERSION "@API_VERSION@"
#define GETDNS_API_NUMERIC_VERSION @API_NUMERIC_VERSION@ #define GETDNS_API_NUMERIC_VERSION @API_NUMERIC_VERSION@
#define GETDNS_BUILD_CFLAGS "@GETDNS_BUILD_CFLAGS@"
/** @} /** @}
*/ */