@@ -122,19 +122,24 @@ endforeach()
122122# SRT_MAVG_SAMPLING_RATE 40 /* Max sampling rate */
123123# SRT_ENABLE_FREQUENT_LOG_TRACE 0 : set to 1 to enable printing reason for suppressed freq logs
124124
125- # CMake offers the OLD behavior, where names that are defined below with
126- # option() function, will be deleted if they are not in cache or do not have set
127- # type - so effectively options provided through LIBSRT_* prefix would be rejected.
128- # We do want these variables, obviously.
129- # NOTE: This is introduced in cmake 3.13, so the namespaced-option feature will not
130- # work properly in the old cmake.
131- if (CMAKE_VERSION VERSION_GREATER 3.12)
132- cmake_policy (SET CMP0077 NEW )
133- endif ()
134-
135- # Import all options preceded with LIBSRT_ likely from a parent scope.
136- # Names are not being checked, at worst it will set an unused variable.
137- srt_import_parent_options ()
125+ # Blocked by a general enabler, LIBSRT_ENABLE_IMPORT_VARIABLES, to prevent accidental use.
126+ if ( (DEFINED LIBSRT_ENABLE_IMPORT_VARIABLES) AND (LIBSRT_ENABLE_IMPORT_VARIABLES EQUAL 1))
127+ unset (LIBSRT_ENABLE_IMPORT_VARIABLES)
128+
129+ # CMake offers sometimes OLD behavior, where names that are defined below with
130+ # option() function, will be deleted if they are not in cache or do not have set
131+ # type - so effectively options provided through LIBSRT_* prefix would be rejected.
132+ # We do want these variables, obviously.
133+ # NOTE: This is introduced in cmake 3.13, so the namespaced-option feature will not
134+ # work properly in the old cmake.
135+ if (CMAKE_VERSION VERSION_GREATER 3.12)
136+ cmake_policy (SET CMP0077 NEW )
137+ endif ()
138+
139+ # Import all options preceded with LIBSRT_ likely from a parent scope.
140+ # Names are not being checked, at worst it will set an unused variable.
141+ srt_import_parent_options ()
142+ endif ()
138143
139144# option defaults
140145set (ENABLE_HEAVY_LOGGING_DEFAULT OFF )
0 commit comments