build system: work around strange cmake issue

On both Mac and Linux cmake 3.12 complained that there were "no sources given
to target" for the Subsurface-mobile target, which made no sense at all (easy
enough to add debug output to ensure there were, in fact, sources given in the
call to add_executable()). But splitting this across two lines like this seems
to make it work both for older and newer cmake versions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2018-10-08 12:02:47 -07:00
parent a95e658946
commit 4012ac1c50

View file

@ -304,7 +304,11 @@ if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable")
if(ANDROID)
add_library(${SUBSURFACE_TARGET} SHARED ${SUBSURFACE_PKG} ${MOBILE_SRC} ${SUBSURFACE_RESOURCES} ${MOBILE_RESOURCES})
else()
add_executable(${SUBSURFACE_TARGET} MACOSX_BUNDLE WIN32 ${SUBSURFACE_PKG} ${MOBILE_SRC} ${SUBSURFACE_RESOURCES} ${MOBILE_RESOURCES})
# the following is split across two commands since in cmake 3.12 this would result
# in a non-sensical "no sources given to target" error if done all as one set of
# arguments to the add_executable() call
add_executable(${SUBSURFACE_TARGET} ${SUBSURFACE_PKG} ${SUBSURFACE_RESOURCES})
target_sources(${SUBSURFACE_TARGET} PUBLIC ${MOBILE_SRC} ${MOBILE_RESOURCES})
endif()
target_link_libraries(
${SUBSURFACE_TARGET}