File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -195,6 +195,14 @@ function (add_flangrt_library name)
195195 # Use same stem name for .a and .so. Common in UNIX environments.
196196 # Not possible in Windows environments.
197197 set_target_properties (${tgtname} PROPERTIES OUTPUT_NAME "${name} " )
198+
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 ()
198206 endif ()
199207
200208 if (ARG_INSTALL_WITH_TOOLCHAIN)
Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ endif()
170170# avoid an unwanted dependency on libstdc++.so.
171171add_compile_definitions (_GLIBCXX_NO_ASSERTIONS)
172172if (NOT WIN32 )
173- add_definitions (-U_GLIBCXX_ASSERTIONS)
173+ add_definitions (-U_GLIBCXX_ASSERTIONS -D_GLIBCXX_NO_ASSERTIONS )
174174endif ()
175175
176176# Add the OpenMP library
You can’t perform that action at this time.
0 commit comments