File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,13 @@ include(CheckCXXCompilerFlag)
22
33# Define the function
44function (filter_supported_compiler_flags input_flags_var output_flags_var)
5+ string (MD5 input_hash "${${input_flags_var} }" )
6+ if (DEFINED SUPPORTED_FLAGS_${input_hash} )
7+ message (STATUS "Using cached flags for ${input_flags_var} : ${SUPPORTED_FLAGS_${input_hash} }" )
8+ set (${output_flags_var} ${SUPPORTED_FLAGS_${input_hash} } PARENT_SCOPE)
9+ return ()
10+ endif ()
11+
512 # Create an empty list to store supported flags
613 set (supported_flags)
714 # Iterate over each flag in the input list
@@ -23,7 +30,8 @@ function(filter_supported_compiler_flags input_flags_var output_flags_var)
2330 # remove last flag from CMAKE_EXE_LINKER_FLAGS using substring
2431 set (CMAKE_EXE_LINKER_FLAGS ${ORIGINAL_LINKER_FLAGS} )
2532 endforeach ()
26- # Set the output variable to the list of supported flags
33+ # Set the output variable to the list of supported flags and cache them
34+ set (SUPPORTED_FLAGS_${input_hash} "${supported_flags} " CACHE INTERNAL "" )
2735 set (${output_flags_var} ${supported_flags} PARENT_SCOPE)
2836endfunction ()
2937
You can’t perform that action at this time.
0 commit comments