diff options
author | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2019-03-22 14:57:46 +0200 |
---|---|---|
committer | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2019-03-22 17:16:57 +0200 |
commit | 5c379a306f43615c018b03d27319f601a4281221 (patch) | |
tree | 6c9ec22d3e07e258f092608c3bf01549c744c0a2 | |
parent | 2de2b0b068520a55170d23c86f349232b3e28ae7 (diff) | |
download | qtlocation-mapboxgl-5c379a306f43615c018b03d27319f601a4281221.tar.gz |
[build] Fix build failures with old cmake versionupstream/nagineni-glfw-fix
COMPILE_OPTIONS source file property was added in cmake version 3.11, so
using that option to set rtti flag on a source file is causing a build
failure if the cmake version is older than 3.11.
To fix the issue with old cmake version, use COMPILE_FLAGS to set the
rtti flag.
-rw-r--r-- | cmake/glfw.cmake | 9 | ||||
-rw-r--r-- | cmake/offline.cmake | 9 | ||||
-rw-r--r-- | cmake/render.cmake | 9 |
3 files changed, 24 insertions, 3 deletions
diff --git a/cmake/glfw.cmake b/cmake/glfw.cmake index a2adb9fbb5..961c4ade2d 100644 --- a/cmake/glfw.cmake +++ b/cmake/glfw.cmake @@ -3,7 +3,14 @@ add_executable(mbgl-glfw ) # args requires RTTI -set_source_files_properties(platform/glfw/main.cpp PROPERTIES COMPILE_OPTIONS "-frtti") +# COMPILE_OPTIONS source file property was added in cmake version 3.11, so use +# the property if the cmake version is 3.11 and greater. For older version of +# cmake, use COMPILE_FLAGS to set the RTTI flag. +if(CMAKE_VERSION VERSION_LESS 3.11.0) + set_source_files_properties(platform/glfw/main.cpp PROPERTIES COMPILE_FLAGS "-frtti") +else() + set_source_files_properties(platform/glfw/main.cpp PROPERTIES COMPILE_OPTIONS "-frtti") +endif() target_sources(mbgl-glfw PRIVATE platform/glfw/glfw_view.hpp diff --git a/cmake/offline.cmake b/cmake/offline.cmake index b751125297..4db29ae040 100644 --- a/cmake/offline.cmake +++ b/cmake/offline.cmake @@ -3,7 +3,14 @@ add_executable(mbgl-offline ) # args requires RTTI -set_source_files_properties(bin/offline.cpp PROPERTIES COMPILE_OPTIONS "-frtti") +# COMPILE_OPTIONS source file property was added in cmake version 3.11, so use +# the property if the cmake version is 3.11 and greater. For older version of +# cmake, use COMPILE_FLAGS to set the RTTI flag. +if(CMAKE_VERSION VERSION_LESS 3.11.0) + set_source_files_properties(bin/offline.cpp PROPERTIES COMPILE_FLAGS "-frtti") +else() + set_source_files_properties(bin/offline.cpp PROPERTIES COMPILE_OPTIONS "-frtti") +endif() target_sources(mbgl-offline PRIVATE platform/default/include/mbgl/util/default_styles.hpp diff --git a/cmake/render.cmake b/cmake/render.cmake index 776c859bad..21c5ca4db1 100644 --- a/cmake/render.cmake +++ b/cmake/render.cmake @@ -3,7 +3,14 @@ add_executable(mbgl-render ) # args requires RTTI -set_source_files_properties(bin/render.cpp PROPERTIES COMPILE_OPTIONS "-frtti") +# COMPILE_OPTIONS source file property was added in cmake version 3.11, so use +# the property if the cmake version is 3.11 and greater. For older version of +# cmake, use COMPILE_FLAGS to set the RTTI flag. +if(CMAKE_VERSION VERSION_LESS 3.11.0) + set_source_files_properties(bin/render.cpp PROPERTIES COMPILE_FLAGS "-frtti") +else() + set_source_files_properties(bin/render.cpp PROPERTIES COMPILE_OPTIONS "-frtti") +endif() target_include_directories(mbgl-render PRIVATE platform/default/include |