File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -190,19 +190,22 @@ function (add_flangrt_library name)
190190 endif ()
191191 endif ()
192192
193+ # Must use minimum optimization level of -O2 to prevent dependency on libstdc++
194+ foreach (tgtname IN LISTS srctargets)
195+ string (REPLACE "-O0" "-O2" CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS )
196+ string (REPLACE "-O1" "-O2" CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS )
197+ string (FIND "-O" CMAKE_CXX_FLAGS opt_idx)
198+ if (opt_idx EQUAL -1)
199+ target_compile_options (${tgtname} PRIVATE -O2)
200+ endif ()
201+ endforeach ()
202+
193203 foreach (tgtname IN LISTS libtargets)
194204 if (NOT WIN32 )
195205 # Use same stem name for .a and .so. Common in UNIX environments.
196206 # Not possible in Windows environments.
197207 set_target_properties (${tgtname} PROPERTIES OUTPUT_NAME "${name} " )
198208
199- # Must use minimum optimization level of -O2 to prevent dependency on libstdc++
200- string (REPLACE "-O0" "-O2" CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS )
201- string (REPLACE "-O1" "-O2" CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS )
202- string (FIND "-O" CMAKE_CXX_FLAGS opt_idx)
203- if (opt_idx EQUAL -1)
204- target_compile_options (${tgtname} PRIVATE -O2)
205- endif ()
206209 endif ()
207210
208211 if (ARG_INSTALL_WITH_TOOLCHAIN)
You can’t perform that action at this time.
0 commit comments