summaryrefslogtreecommitdiff
path: root/cmake/mbgl.cmake
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-06-03 18:05:04 +0200
committerKonstantin Käfer <mail@kkaefer.com>2016-08-05 11:42:22 +0200
commit692fe1f3ffc8f4364b39c14aa7d90cec2ff5c0a6 (patch)
tree1d08af7d56e986dba2b548ff9b9a7e1a77c713ed /cmake/mbgl.cmake
parente3ee55b28d0b230d054c9718f79a1f6d685cd62b (diff)
downloadqtlocation-mapboxgl-692fe1f3ffc8f4364b39c14aa7d90cec2ff5c0a6.tar.gz
[build] switch to CMake
This is very much a work in progress.
Diffstat (limited to 'cmake/mbgl.cmake')
-rw-r--r--cmake/mbgl.cmake50
1 files changed, 50 insertions, 0 deletions
diff --git a/cmake/mbgl.cmake b/cmake/mbgl.cmake
new file mode 100644
index 0000000000..105c8822e9
--- /dev/null
+++ b/cmake/mbgl.cmake
@@ -0,0 +1,50 @@
+if (NOT DEFINED MBGL_PLATFORM)
+ if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
+ set(MBGL_PLATFORM "macos")
+ else()
+ set(MBGL_PLATFORM "linux")
+ endif()
+endif()
+
+if(MBGL_PLATFORM STREQUAL "macos")
+ set(ENV{MASON_PLATFORM} "osx")
+else()
+ set(ENV{MASON_PLATFORM} ${MBGL_PLATFORM})
+endif()
+
+set(MBGL_GENERATED ${CMAKE_BINARY_DIR}/generated/${CMAKE_CFG_INTDIR})
+
+# Generate source groups so the files are properly sorted in IDEs like Xcode.
+function(create_source_groups target)
+ get_target_property(sources ${target} SOURCES)
+ foreach(file ${sources})
+ get_filename_component(file "${file}" ABSOLUTE)
+ string(REGEX REPLACE "^${CMAKE_SOURCE_DIR}/" "" group "${file}")
+ get_filename_component(group "${group}" DIRECTORY)
+ string(REPLACE "/" "\\" group "${group}")
+ source_group("${group}" FILES "${file}")
+ endforeach()
+endfunction()
+
+function(_write_xcconfig_var target var)
+ get_property(result TARGET ${target} PROPERTY INTERFACE_${var} SET)
+ if (result)
+ get_property(result TARGET ${target} PROPERTY INTERFACE_${var})
+ string(REPLACE ";" "\" \"" result "${result}")
+ string(REPLACE "-" "_" target "${target}")
+ file(APPEND "${CMAKE_BINARY_DIR}/config.xcconfig" "${target}_${var} = \"${result}\"\n")
+ endif()
+endfunction()
+
+function(target_append_xcconfig target)
+ file(APPEND "${CMAKE_BINARY_DIR}/config.xcconfig" "\n// ${target}\n")
+ _write_xcconfig_var(${target} INCLUDE_DIRECTORIES)
+ _write_xcconfig_var(${target} COMPILE_DEFINITIONS)
+ _write_xcconfig_var(${target} COMPILE_OPTIONS)
+ _write_xcconfig_var(${target} LINK_LIBRARIES)
+endfunction()
+
+# Start a new file when we're running CMake
+file(WRITE "${CMAKE_BINARY_DIR}/config.xcconfig" "// Do not edit -- generated by CMake\n")
+
+set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10)