aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorfuzzard <fuzzard@kodi.tv>2022-06-19 19:35:18 +1000
committerfuzzard <fuzzard@kodi.tv>2022-06-25 06:39:47 +1000
commitabca4f54d5ebd765b356e6e325e292bb66129384 (patch)
treec45c52630c581755456d516c9e5d38d0edfb10af /cmake
parent44f0778f30fae7f0fb010b732b0cf07f658067c4 (diff)
[cmake] modulehelper set default generator for VS/xcode externalproject_add calls
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/buildtools/FindFlatC.cmake10
-rw-r--r--cmake/scripts/common/ModuleHelpers.cmake15
2 files changed, 19 insertions, 6 deletions
diff --git a/cmake/modules/buildtools/FindFlatC.cmake b/cmake/modules/buildtools/FindFlatC.cmake
index 693d1db4f2..65bcbff3e4 100644
--- a/cmake/modules/buildtools/FindFlatC.cmake
+++ b/cmake/modules/buildtools/FindFlatC.cmake
@@ -43,16 +43,14 @@ if(NOT FLATBUFFERS_FLATC_EXECUTABLE)
-DFLATBUFFERS_BUILD_GRPCTEST=OFF
-DFLATBUFFERS_BUILD_SHAREDLIB=OFF)
- if(CMAKE_GENERATOR STREQUAL Xcode)
- set(FLATBUFFERS_GENERATOR CMAKE_GENERATOR "Unix Makefiles")
- endif()
-
# Set host build info for buildtool
if(EXISTS "${NATIVEPREFIX}/share/Toolchain-Native.cmake")
set(FLATBUFFERS_TOOLCHAIN_FILE "${NATIVEPREFIX}/share/Toolchain-Native.cmake")
- elseif(WIN32 OR WINDOWS_STORE)
+ endif()
+
+ if(WIN32 OR WINDOWS_STORE)
+ # Make sure we generate for host arch, not target
set(FLATBUFFERS_GENERATOR_PLATFORM CMAKE_GENERATOR_PLATFORM ${HOSTTOOLSET})
- set(FLATBUFFERS_GENERATOR CMAKE_GENERATOR "${CMAKE_GENERATOR}")
endif()
set(FLATBUFFERS_FLATC_EXECUTABLE ${INSTALL_DIR}/flatc CACHE INTERNAL "FlatBuffer compiler")
diff --git a/cmake/scripts/common/ModuleHelpers.cmake b/cmake/scripts/common/ModuleHelpers.cmake
index 0525f1b47e..3898aa1ab7 100644
--- a/cmake/scripts/common/ModuleHelpers.cmake
+++ b/cmake/scripts/common/ModuleHelpers.cmake
@@ -216,6 +216,21 @@ macro(BUILD_DEP_TARGET)
endif()
endif()
endif()
+
+ # Xcode - Default sub projects to makefile builds. More consistent
+ # Windows - Default to same generator version used in parent
+ if(CMAKE_GENERATOR STREQUAL Xcode)
+ if(NOT ${MODULE}_GENERATOR)
+ set(${MODULE}_GENERATOR CMAKE_GENERATOR "Unix Makefiles")
+ endif()
+ elseif(MSVC)
+ if(NOT ${MODULE}_GENERATOR)
+ set(${MODULE}_GENERATOR CMAKE_GENERATOR "${CMAKE_GENERATOR}")
+ endif()
+ if(NOT ${MODULE}_GENERATOR_PLATFORM)
+ set(${MODULE}_GENERATOR_PLATFORM CMAKE_GENERATOR_PLATFORM ${CMAKE_GENERATOR_PLATFORM})
+ endif()
+ endif()
endif()
if(PATCH_COMMAND)