未验证 提交 c7fa2955 编写于 作者: J Johan Lorensson 提交者: GitHub

Fix EventPipe source using COMPILE_OPTIONS on old CMake 3.6.2. (#48809)

Older CMake < 3.11 doesn't include COMPILE_OPTIONS source file property.
This property is needed by clang or it will issue warning when building
files with .c extension under c++ compiler.

Fallback to add_compile_options if CMake is older than 3.11. Even if
that option has wider scope, this is only applied to files in eventpipe
directory or in debug-pal.

Keeping the more precise set_source_files_properties on newer CMake and
when we can upgrade CMake to 3.11 or newer we could get rid of this.
上级 e97319a8
......@@ -38,7 +38,11 @@ if(CLR_CMAKE_HOST_UNIX)
set (EVENTPIPE_PAL_SOURCES "${SHARED_EVENTPIPE_DIR}/ds-ipc-posix.c")
set_source_files_properties(${EVENTPIPE_PAL_SOURCES} PROPERTIES LANGUAGE CXX)
set_source_files_properties(${EVENTPIPE_PAL_SOURCES} PROPERTIES COMPILE_OPTIONS -xc++)
if (CMAKE_VERSION VERSION_GREATER 3.11 OR CMAKE_VERSION VERSION_EQUAL 3.11)
set_source_files_properties(${EVENTPIPE_PAL_SOURCES} PROPERTIES COMPILE_OPTIONS -xc++)
else(CMAKE_VERSION VERSION_GREATER 3.11 OR CMAKE_VERSION VERSION_EQUAL 3.11)
add_compile_options(-xc++)
endif()
set(TWO_WAY_PIPE_SOURCES
${EVENTPIPE_PAL_SOURCES}
......
......@@ -65,7 +65,11 @@ set_source_files_properties(${SHARED_EVENTPIPE_SOURCE_PATH}/ds-sources.c PROPERT
set_source_files_properties(${EVENTPIPE_SOURCES} PROPERTIES LANGUAGE CXX)
if(CLR_CMAKE_HOST_UNIX)
set_source_files_properties(${EVENTPIPE_SOURCES} PROPERTIES COMPILE_OPTIONS -xc++)
if (CMAKE_VERSION VERSION_GREATER 3.11 OR CMAKE_VERSION VERSION_EQUAL 3.11)
set_source_files_properties(${EVENTPIPE_SOURCES} PROPERTIES COMPILE_OPTIONS -xc++)
else(CMAKE_VERSION VERSION_GREATER 3.11 OR CMAKE_VERSION VERSION_EQUAL 3.11)
add_compile_options(-xc++)
endif()
endif(CLR_CMAKE_HOST_UNIX)
list(APPEND CORECLR_EVENTPIPE_SHIM_SOURCES
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册