Skip to content

Commit 886111a

Browse files
committed
Fix NaCl build breakage
FORK=1 is needed to know whether the nacl-vms target has been created already.
1 parent b0c63f7 commit 886111a

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

cmake/DaemonGame.cmake

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ option(BUILD_GAME_NATIVE_DLL "Build the shared library files, mostly useful for
3838
# can be loaded by daemon with vm.[sc]game.type 2
3939
option(BUILD_GAME_NATIVE_EXE "Build native executable, which might be used for better performances by server owners" OFF)
4040

41+
include(ExternalProject)
4142
include(DaemonBuildInfo)
4243
include(DaemonPlatform)
4344

@@ -171,28 +172,23 @@ function(GAMEMODULE)
171172
set(multiValueArgs DEFINITIONS FLAGS FILES LIBS)
172173
cmake_parse_arguments(GAMEMODULE "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
173174

174-
if (NOT FORK)
175-
if (BUILD_GAME_NACL)
176-
set(FORK 1 PARENT_SCOPE)
177-
endif()
178-
179-
if (BUILD_GAME_NATIVE_DLL)
180-
buildGameModule("native-dll")
181-
endif()
175+
if (BUILD_GAME_NATIVE_DLL)
176+
buildGameModule("native-dll")
177+
endif()
182178

183-
if (BUILD_GAME_NATIVE_EXE)
184-
buildGameModule("native-exe")
185-
endif()
179+
if (BUILD_GAME_NATIVE_EXE)
180+
buildGameModule("native-exe")
186181
endif()
187182

188-
if (FORK EQUAL 1)
183+
if (NOT FORK) # create the nacl-vms target only the first time that GAMEMODULE is called
184+
set(FORK 1 PARENT_SCOPE)
185+
189186
if (CMAKE_GENERATOR MATCHES "Visual Studio")
190187
set(VM_GENERATOR "NMake Makefiles")
191188
else()
192189
set(VM_GENERATOR ${CMAKE_GENERATOR})
193190
endif()
194191

195-
include(ExternalProject)
196192
set(INHERITED_OPTION_ARGS)
197193

198194
foreach(inherited_option ${NACL_VM_INHERITED_OPTIONS})
@@ -248,7 +244,7 @@ function(GAMEMODULE)
248244
endif()
249245

250246
set(NACL_VMS_PROJECTS ${NACL_VMS_PROJECTS} PARENT_SCOPE)
251-
elseif (FORK EQUAL 2)
247+
elseif (FORK EQUAL 2) # we are in the CMake sub-invocation for NaCl
252248
if (BUILD_GAME_NACL)
253249
if (USE_NACL_SAIGO)
254250
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

0 commit comments

Comments
 (0)