Skip to content

Commit 08411aa

Browse files
Emilio LopesEmilio Lopes
authored andcommitted
Prevent compiler options propagating to projects using SML
Compile options added to INTERFACE libraries propagate to any target that includes SML with either FetchContent or add_subdirectory. Add these compile options only when SML is the top level project.
1 parent a2604e7 commit 08411aa

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

CMakeLists.txt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,22 +119,22 @@ elseif (IS_COMPILER_OPTION_GCC_LIKE)
119119
"-pedantic-errors" # Like -pedantic, except that errors are produced rather than warnings
120120
>
121121
)
122-
endif()
123122

124-
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
125-
target_compile_options(sml INTERFACE
126-
# http://stackoverflow.com/questions/30255294/how-to-hide-extra-output-from-pragma-message
127-
$<BUILD_INTERFACE:
128-
"-ftrack-macro-expansion=0"
129-
"-fno-diagnostics-show-caret"
130-
>
131-
)
132-
endif()
133-
134-
if (NOT ${SML_USE_EXCEPTIONS})
135-
target_compile_options(sml INTERFACE
136-
$<BUILD_INTERFACE:"-fno-exceptions"> # compiles without exception support
137-
)
123+
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
124+
target_compile_options(sml INTERFACE
125+
# http://stackoverflow.com/questions/30255294/how-to-hide-extra-output-from-pragma-message
126+
$<BUILD_INTERFACE:
127+
"-ftrack-macro-expansion=0"
128+
"-fno-diagnostics-show-caret"
129+
>
130+
)
131+
endif()
132+
133+
if (NOT ${SML_USE_EXCEPTIONS})
134+
target_compile_options(sml INTERFACE
135+
$<BUILD_INTERFACE:"-fno-exceptions"> # compiles without exception support
136+
)
137+
endif()
138138
endif()
139139
endif ()
140140

0 commit comments

Comments
 (0)