Skip to content

Commit

Permalink
cmake: Use C++ rather than C in test-security-check target
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Jul 11, 2024
1 parent 64dd87c commit 56d3878
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cmake/module/Maintenance.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ function(add_maintenance_targets)
endif()

# In CMake, the components of the compiler invocation are separated into three distinct variables:
# - CMAKE_C_COMPILER_LAUNCHER: a semicolon-separated list of launchers or tools to precede the compiler (e.g., env or ccache).
# - CMAKE_C_COMPILER: the full path to the compiler binary itself (e.g., /usr/bin/clang).
# - CMAKE_C_COMPILER_ARG1: a string containing initial compiler options (e.g., --target=x86_64-apple-darwin -nostdlibinc).
# - CMAKE_CXX_COMPILER_LAUNCHER: a semicolon-separated list of launchers or tools to precede the compiler (e.g., env or ccache).
# - CMAKE_CXX_COMPILER: the full path to the compiler binary itself (e.g., /usr/bin/clang++).
# - CMAKE_CXX_COMPILER_ARG1: a string containing initial compiler options (e.g., --target=x86_64-apple-darwin -nostdlibinc).
# By concatenating these variables, we form the complete command line to be passed to a Python script via the CC environment variable.
list(JOIN CMAKE_C_COMPILER_LAUNCHER " " c_compiler_command)
string(STRIP "${c_compiler_command} ${CMAKE_C_COMPILER}" c_compiler_command)
string(STRIP "${c_compiler_command} ${CMAKE_C_COMPILER_ARG1}" c_compiler_command)
list(JOIN CMAKE_CXX_COMPILER_LAUNCHER " " cxx_compiler_command)
string(STRIP "${cxx_compiler_command} ${CMAKE_CXX_COMPILER}" cxx_compiler_command)
string(STRIP "${cxx_compiler_command} ${CMAKE_CXX_COMPILER_ARG1}" cxx_compiler_command)
add_custom_target(test-security-check
COMMAND ${CMAKE_COMMAND} -E env CC=${c_compiler_command} CFLAGS=${CMAKE_C_FLAGS} LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${PYTHON_COMMAND} ${CMAKE_SOURCE_DIR}/contrib/devtools/test-security-check.py TestSecurityChecks.test_${exe_format}
COMMAND ${CMAKE_COMMAND} -E env CC=${c_compiler_command} CFLAGS=${CMAKE_C_FLAGS} LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${PYTHON_COMMAND} ${CMAKE_SOURCE_DIR}/contrib/devtools/test-symbol-check.py TestSymbolChecks.test_${exe_format}
COMMAND ${CMAKE_COMMAND} -E env CXX=${cxx_compiler_command} CXXFLAGS=${CMAKE_CXX_FLAGS} LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${PYTHON_COMMAND} ${CMAKE_SOURCE_DIR}/contrib/devtools/test-security-check.py TestSecurityChecks.test_${exe_format}
COMMAND ${CMAKE_COMMAND} -E env CXX=${cxx_compiler_command} CXXFLAGS=${CMAKE_CXX_FLAGS} LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${PYTHON_COMMAND} ${CMAKE_SOURCE_DIR}/contrib/devtools/test-symbol-check.py TestSymbolChecks.test_${exe_format}
VERBATIM
)

Expand Down

0 comments on commit 56d3878

Please sign in to comment.