CMake: Move genrated dna.c and cmake_blender_libs.txt to binary directories to keep...
authorJacques Beuarain <jacques.beaurain@gmail.com>
Thu, 7 Dec 2006 00:18:57 +0000 (00:18 +0000)
committerJacques Beuarain <jacques.beaurain@gmail.com>
Thu, 7 Dec 2006 00:18:57 +0000 (00:18 +0000)
CMake/macros.cmake
CMakeLists.txt
blenderplayer/CMakeLists.txt
source/blender/makesdna/intern/CMakeLists.txt
source/creator/CMakeLists.txt

index f5b6d1214a69c9f8b49db62af942968cf40a6538..6b6837d25f0526667e29a74f7552f814335cdd95 100644 (file)
@@ -34,7 +34,7 @@ MACRO(BLENDERLIB
   BLENDERLIB_NOLIST(${name} "${sources}" "${includes}")
 
   # Add to blender's list of libraries
-  FILE(APPEND ${CMAKE_SOURCE_DIR}/cmake_blender_libs.txt "${name};")
+  FILE(APPEND ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt "${name};")
 ENDMACRO(BLENDERLIB)
 
 MACRO(SETUP_LIBDIRS)
index a0165ba4d383df1eb73282f6987dd5e471a9bf51..b8d6c0598c8ec68a1d7856316dfaa32b07c00fb3 100644 (file)
@@ -361,7 +361,7 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ")
 
 #-----------------------------------------------------------------------------
 # Libraries
-FILE(WRITE ${CMAKE_SOURCE_DIR}/cmake_blender_libs.txt "")
+FILE(WRITE ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt "")
 SUBDIRS(
   intern
   extern
index 3648ea46150b469dd330666bb009eced5c0007df..aa60c6c48feb0152a55d326bd5a72ac0168b0a05 100644 (file)
@@ -31,22 +31,26 @@ MESSAGE(STATUS "Configuring blenderplayer")
 
 SETUP_LIBDIRS()
 
-FILE(APPEND ../source/blender/makesdna/intern/dna.c "")
-
 IF(WITH_QUICKTIME)
   ADD_DEFINITIONS(-DWITH_QUICKTIME)
 ENDIF(WITH_QUICKTIME)
 
+ADD_CUSTOM_COMMAND(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dna.c
+  COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna ${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_SOURCE_DIR}/source/blender/makesdna/
+  DEPENDS ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna
+)
+
 IF(WIN32)
-  ADD_EXECUTABLE(blenderplayer ${EXETYPE} ../source/blender/makesdna/intern/dna.c ../source/icons/winplayer.rc)
+  ADD_EXECUTABLE(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../source/icons/winblender.rc)
 ELSE(WIN32)
-  ADD_EXECUTABLE(blenderplayer ../source/blender/makesdna/intern/dna.c)
+  ADD_EXECUTABLE(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
 ENDIF(WIN32)
 
 ADD_DEPENDENCIES(blenderplayer makesdna)
 
 SETUP_LIBLINKS(blenderplayer)
-FILE(READ ${CMAKE_SOURCE_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS)
+FILE(READ ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS)
 
 SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} gp_common gp_ghost blenkernel_blc)
 
@@ -107,7 +111,7 @@ IF(UNIX)
       ENDIF(${SEARCHLIB} STREQUAL ${SORTLIB})
     ENDFOREACH(SEARCHLIB)
     IF(REMLIB)
-      MESSAGE("Removing library ${REMLIB} from blenderplayer linking because: not configured")
+      MESSAGE(STATUS "Removing library ${REMLIB} from blenderplayer linking because: not configured")
       LIST(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
     ENDIF(REMLIB)
   ENDFOREACH(SORTLIB)
index adac927cf55d537852a3c7b55f367424d8eeecaa..58aa4b3cd214be72c1838df2149500b7b349e1f7 100644 (file)
@@ -34,11 +34,4 @@ INCLUDE_DIRECTORIES(../../../../intern/guardedalloc ..)
 FILE(GLOB INC_FILES ../*.h)
 ADD_EXECUTABLE(makesdna ${SRC} ${INC_FILES})
 
-ADD_CUSTOM_COMMAND(TARGET makesdna
-  POST_BUILD
-  COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna ${CMAKE_SOURCE_DIR}/source/blender/makesdna/intern/dna.c ${CMAKE_SOURCE_DIR}/source/blender/makesdna/
-  DEPENDS ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna
-)
-#  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}
-
 MESSAGE(STATUS "Configuring makesdna")
index 05b221c1dff056427ecc62ee7cdc3cac4afbd433..96a0fc8844f87f5019d2873a19481ecf0806f59d 100644 (file)
@@ -29,8 +29,6 @@
 
 SETUP_LIBDIRS()
 
-FILE(APPEND ../blender/makesdna/intern/dna.c "")
-
 INCLUDE_DIRECTORIES(../../intern/guardedalloc
   ../blender/blenlib
   ../blender/blenkernel
@@ -51,10 +49,16 @@ ENDIF(WITH_QUICKTIME)
 
 MESSAGE(STATUS "Configuring blender")
 
+ADD_CUSTOM_COMMAND(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dna.c
+  COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna ${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_SOURCE_DIR}/source/blender/makesdna/
+  DEPENDS ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna
+)
+
 IF(WIN32)
-  ADD_EXECUTABLE(blender ${EXETYPE} creator.c ../blender/makesdna/intern/dna.c ../icons/winblender.rc)
+  ADD_EXECUTABLE(blender ${EXETYPE} creator.c ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc)
 ELSE(WIN32)
-  ADD_EXECUTABLE(blender ${EXETYPE} creator.c ../blender/makesdna/intern/dna.c)
+  ADD_EXECUTABLE(blender ${EXETYPE} creator.c ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
 ENDIF(WIN32)
 
 IF(APPLE)
@@ -87,7 +91,7 @@ ENDIF(APPLE)
 ADD_DEPENDENCIES(blender makesdna)
 
 SETUP_LIBLINKS(blender)
-FILE(READ ${CMAKE_SOURCE_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS)
+FILE(READ ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS)
 
 SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} src blender_python blender_render blender_radiosity blender_IK bf_elbeem)
 
@@ -163,7 +167,7 @@ IF(UNIX)
       ENDIF(${SEARCHLIB} STREQUAL ${SORTLIB})
     ENDFOREACH(SEARCHLIB)
     IF(REMLIB)
-      MESSAGE("Removing library ${REMLIB} from blender linking because: not configured")
+      MESSAGE(STATUS "Removing library ${REMLIB} from blender linking because: not configured")
       LIST(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
     ENDIF(REMLIB)
   ENDFOREACH(SORTLIB)