@@ -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
3939option (BUILD_GAME_NATIVE_EXE "Build native executable, which might be used for better performances by server owners" OFF )
4040
41+ include (ExternalProject)
4142include (DaemonBuildInfo)
4243include (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