Finally got CMake compilation to work.
[blender-staging.git] / source / blender / makesdna / intern / CMakeLists.txt
index a85f561da92f2e79d481e2261f8bf5d1c76bcdc0..6024799f8526e5f4d6ae27bc71d247882f7fd82f 100644 (file)
 #
 # ***** END GPL LICENSE BLOCK *****
 
-SET(SRC makesdna.c ../../../../intern/guardedalloc/intern/mallocn.c ../../../../intern/guardedalloc/intern/mmap_win.c)
-
 INCLUDE_DIRECTORIES(../../../../intern/guardedalloc ..)
-
 FILE(GLOB INC_FILES ../*.h)
+
+# Build makesdna executable
+SET(SRC makesdna.c ../../../../intern/guardedalloc/intern/mallocn.c ../../../../intern/guardedalloc/intern/mmap_win.c)
 ADD_EXECUTABLE(makesdna ${SRC} ${INC_FILES})
 
+# Output dna.c
+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 makesdna
+)
+
+# Build bf_dna library
+SET(SRC dna_genfile.c dna.c)
+BLENDERLIB(bf_dna "${SRC}" "${INC}")
+
 MESSAGE(STATUS "Configuring makesdna")