Code

process source subdirectories with INCLUDE() instead of ADD_DIRECTORIES()
authoracspike <acspike@users.sourceforge.net>
Thu, 10 Apr 2008 04:48:40 +0000 (04:48 +0000)
committeracspike <acspike@users.sourceforge.net>
Thu, 10 Apr 2008 04:48:40 +0000 (04:48 +0000)
This more or less mimics what is being done by automake with the Makefile_insert files
What we were doing before did not work because add_directories() isn't able to
propagate variables upwards.

15 files changed:
src/CMakeLists.txt
src/api/CMakeLists.txt
src/bind/CMakeLists.txt
src/debug/CMakeLists.txt
src/display/CMakeLists.txt
src/dom/CMakeLists.txt
src/dom/odf/CMakeLists.txt
src/extension/CMakeLists.txt
src/extension/internal/CMakeLists.txt
src/extension/param/CMakeLists.txt
src/jabber_whiteboard/CMakeLists.txt
src/live_effects/CMakeLists.txt
src/live_effects/parameter/CMakeLists.txt
src/trace/CMakeLists.txt
src/ui/CMakeLists.txt

index f047198bbceca9eaa9fa6aede052c15c6a7249ed..aaf6bbe285c6396371660d56bf1451317493d086 100644 (file)
@@ -1,3 +1,92 @@
+SET(INKSCAPE_SRC)\r
+\r
+# A macro to replace slashes and spaces in a string with underscores\r
+MACRO(SANITIZE_PATH _string_var)\r
+  STRING(REGEX REPLACE "[\\/ ]+" "_" ${_string_var} ${${_string_var}})\r
+ENDMACRO(SANITIZE_PATH _string_var)\r
+\r
+# A macro to prepend a given string onto the beginning of each string in a list\r
+MACRO(PREPEND _list _str)\r
+  SET(_temp_list ${${_list}})\r
+  SET(${_list})\r
+  FOREACH(x ${_temp_list})\r
+    SET(${_list} ${${_list}} ${_str}${x})\r
+  ENDFOREACH(x)\r
+ENDMACRO(PREPEND _list _str)\r
+\r
+# All folder with CMakeLists.txt files (excluding internal libraries)\r
+SET(srcfolders\r
+algorithms\r
+api\r
+bind\r
+debug\r
+display\r
+dom\r
+dom/io\r
+dom/odf\r
+dom/util\r
+dom/work\r
+extension\r
+extension/dxf2svg\r
+extension/implementation\r
+extension/internal\r
+extension/param\r
+graphlayout\r
+helper\r
+inkjar\r
+io\r
+jabber_whiteboard\r
+jabber_whiteboard/dialog\r
+live_effects\r
+live_effects/parameter\r
+pedro\r
+removeoverlap\r
+svg\r
+trace\r
+trace/potrace\r
+traits\r
+ui/cache\r
+ui\r
+ui/dialog\r
+ui/view\r
+ui/widget\r
+utest\r
+util\r
+widgets\r
+xml\r
+)\r
+\r
+# 1) include each list file\r
+# 2) grab the variable inside \r
+# 3) prepend the full relative path to each file in list\r
+# 4) append the list to INKSCAPE_SRC\r
+FOREACH(dirlist ${srcfolders})\r
+  SET(_temp_dirlist "${dirlist}")\r
+  MESSAGE(STATUS "Processing ${CMAKE_CURRENT_SOURCE_DIR}/${dirlist}/CMakeLists.txt")\r
+  INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/${dirlist}/CMakeLists.txt)\r
+  SANITIZE_PATH(dirlist)\r
+  PREPEND(${dirlist}_SRC "${_temp_dirlist}/")\r
+  SET(INKSCAPE_SRC ${INKSCAPE_SRC} ${${dirlist}_SRC})\r
+ENDFOREACH(dirlist)\r
+\r
+\r
+# All directories containing lists files that describe building internal libraries\r
+SET(libfolders\r
+application\r
+dialogs\r
+libavoid\r
+libcola\r
+libcroco\r
+libgdl\r
+libnr\r
+libnrtype\r
+libvpsc\r
+)\r
+\r
+FOREACH(dirlist ${libfolders})\r
+  ADD_SUBDIRECTORY(${dirlist})\r
+ENDFOREACH(dirlist)\r
+\r
 IF(WIN32)\r
 SET(ONLY_WIN\r
 registrytool.cpp\r
@@ -7,6 +96,7 @@ SET(ONLY_WIN)
 ENDIF(WIN32)\r
 \r
 SET(INKSCAPE_SRC\r
+${INKSCAPE_SRC}\r
 arc-context.cpp\r
 attributes.cpp\r
 axis-manip.cpp\r
@@ -208,31 +298,6 @@ version.cpp
 winmain.cpp\r
 zoom-context.cpp\r
 ${ONLY_WIN}\r
-${algorithms}\r
-${api}\r
-${application}\r
-${BIND_SRC}\r
-${debug}\r
-${dialogs}\r
-${display}\r
-${dom_SRC}\r
-${extension_SRC}\r
-${graphlayout_SRC}\r
-${extension_SRC}\r
-${helper_SRC}\r
-${inkjar_SRC}\r
-${io_SRC}\r
-${jabber_whiteboard_SRC}\r
-${live_effects_SRC}\r
-${removeoverlap_SRC}\r
-${svg_SRC}\r
-${trace_SRC}\r
-${traits_SRC}\r
-${ui_SRC}\r
-#${utest_SRC}\r
-#${util_SRC}\r
-#${widgets_SRC}\r
-#${xml_SRC}\r
 )\r
 \r
 # make executable for INKSCAPE\r
@@ -252,47 +317,3 @@ TARGET_LINK_LIBRARIES(inkscape
 #CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/INKSCAPE.pc.in\r
 #                ${CMAKE_BINARY_DIR}/INKSCAPE.pc @ONLY IMMEDIATE )\r
 #INSTALL(FILES "${CMAKE_BINARY_DIR}/INKSCAPE.pc" DESTINATION lib/pkgconfig)\r
-\r
-\r
-# Add New folders in src folder here\r
-SET(srcfolders\r
-2geom\r
-algorithms\r
-api\r
-application\r
-bind\r
-debug\r
-dialogs\r
-display\r
-dom\r
-extension\r
-graphlayout\r
-helper\r
-inkjar\r
-io\r
-jabber_whiteboard\r
-libavoid\r
-libcola\r
-libcroco\r
-libgdl\r
-libnr\r
-libnrtype\r
-libvpsc\r
-livarot\r
-live_effects\r
-pedro\r
-svg\r
-pixmaps\r
-trace\r
-traits\r
-ui\r
-removeoverlap\r
-utest\r
-util\r
-widgets\r
-xml\r
-)\r
-\r
-FOREACH(dirlist ${srcfolders})\r
-ADD_SUBDIRECTORY(${dirlist})\r
-ENDFOREACH(dirlist)\r
index 84ac8b19ae0b528646eca020af7d61b81fe57de1..e6dfe1105d7b9b154d21887ff2131899574c55a4 100644 (file)
@@ -1,3 +1,3 @@
 SET(api
-inkscape.idl
+api/inkscape.idl
 )
index c56bbd05de7731cf100e9030e8d0945b7213c2b0..bc52a6462b2b45407d87f53a59c8115029d626cb 100644 (file)
@@ -1,16 +1,6 @@
-SET(BIND_SRC
+SET(bind_SRC
 dobinding.cpp
 javabind.cpp
 #javabind.h
 #javabind-private.h
 )
-
-# Add New folders in src folder here
-SET(bindfolders
-java
-javainc
-)
-\r
-FOREACH(binddirlist ${bindfolders})
-ADD_SUBDIRECTORY(${binddirlist})
-ENDFOREACH(binddirlist)
index 8e76dda4e69946ab51b9aaa005f789f54a2be9eb..88406d4c7d498567b8aad5c083f4c2f30299c93c 100644 (file)
@@ -1,4 +1,4 @@
-SET(debug
+SET(debug_SRC
 demangle.cpp
 #demangle.h
 #event.h
index b0f9b1dc87528ff10966e2f097bb8b90be3e9d88..71245d3abf9ed6a9ce1b63699dfa1b2df1aac8e2 100644 (file)
@@ -1,4 +1,4 @@
-SET(display
+SET(display_SRC
 bezier-utils.cpp
 bezier-utils-test.cpp
 canvas-arena.cpp
index 5f0cea63b2329175c25455aec384fb3e3be01adf..503f9d0cca215bd5c8de9ffa01eba0552cc30776 100644 (file)
@@ -18,20 +18,4 @@ xmlwriter.cpp
 xpathimpl.cpp
 xpathparser.cpp
 xpathtoken.cpp
-${dom_io_SRC}
-${dom_odf_SRC}
-${dom_util_SRC}
-${dom_work_SRC}
 )
-# Add New folders in src folder here
-SET(domfolders
-io
-odf
-util
-work
-)
-\r
-FOREACH(domdirlist ${domfolders})
-ADD_SUBDIRECTORY(${domdirlist})
-ENDFOREACH(domdirlist)
-
index fd1e49b859c05bcc3bd1df84bd7ea5e83ee29075..7a4b1ea4ef094042271e62e9fe56ceb221e68909 100644 (file)
@@ -1,11 +1,5 @@
 SET(dom_odf_SRC
-base64stream.cpp
-bufferstream.cpp
-domstream.cpp
-gzipstream.cpp
-httpclient.cpp
-socket.cpp
-stringstream.cpp
-uristream.cpp
+odfdocument.cpp
+SvgOdg.cpp
 )
 
index f6ee9e3ec5f14338670d7cf77d50a58911ba7d7b..56781f9090150805739d6046dcd9b25a85cd8a64 100644 (file)
@@ -13,22 +13,4 @@ prefdialog.cpp
 print.cpp
 system.cpp
 timer.cpp
-${extension_dxf2svg_SRC}
-${extension_implementation_SRC}
-${extension_internal_SRC}
-${extension_script_SRC}
 )
-
-# Add New folders in src folder here
-SET(extensionfolders
-dxf2svg
-implementation
-internal
-param
-script
-)
-\r
-FOREACH(extensiondirlist ${extensionfolders})
-ADD_SUBDIRECTORY(${extensiondirlist})
-ENDFOREACH(extensiondirlist)
-
index ada17b480459121a30b2d3a0d074f4210624d413..7125d2e1c46de555979b9c5d08242d3ac99ee936 100644 (file)
@@ -24,17 +24,4 @@ svg.cpp
 svgz.cpp
 win32.cpp
 wpg-input.cpp
-${extension_internal_bitmap_SRC}
-${extension_internal_pdfinput_SRC}
 )
-
-# Add New folders in src folder here
-SET(extensioninternalfolders
-bitmap
-pdfinput
-)
-\r
-FOREACH(extensionINTdirlist ${extensioninternalfolders})
-ADD_SUBDIRECTORY(${extensionINTdirlist})
-ENDFOREACH(extensionINTdirlist)
-
index 8ac3211f26baf151534bd9a2d7bc2b62b5afa96d..843de8b7a4512430952493dbf5f66dfe16dfaff9 100644 (file)
@@ -3,7 +3,7 @@ bool.cpp
 color.cpp
 description.cpp
 enum.cpp
-eter.cpp
+parameter.cpp
 float.cpp
 int.cpp
 notebook.cpp
index 8d5b56d899e3119af8f9cc21bb84168f64f27db9..abc15601b8d46947a9d1b96bd9e3e2f14d400279 100644 (file)
@@ -30,14 +30,4 @@ session-file-selector.h
 session-manager.cpp
 session-manager.h
 tracker-node.h
-${jabber_whiteboard_dialog_SRC}
 )
-
-# Add New folders in src folder here
-SET(jabber_whiteboardfolders
-dialog
-)
-
-FOREACH(jabber_whiteboarddirlist ${jabber_whiteboardfolders})
-ADD_SUBDIRECTORY(${jabber_whiteboarddirlist})
-ENDFOREACH(jabber_whiteboarddirlist)
\ No newline at end of file
index f88e965311d0ece284e1b5baf4d2d31c90f78981..f7a3f77982ab51904edaed42535c1a90c61c426f 100644 (file)
@@ -29,7 +29,5 @@ lpe-vonkoch.cpp
 lpe-vonkoch.h
 n-art-bpath-2geom.cpp
 n-art-bpath-2geom.h
-${live_effects_parameter_SRC}
 )
 
-ADD_SUBDIRECTORY(parameter)
index e3292f3a079ced521c2dc983d3f96cbb55f7bcef..4c429e5868b07d38f4687f1710465f94018a0241 100644 (file)
@@ -4,7 +4,6 @@ bool.h
 enum.h
 makefile.in
 Makefile_insert
-out.txt
 parameter.cpp
 parameter.h
 path.cpp
@@ -17,5 +16,4 @@ pointparam-knotholder.cpp
 pointparam-knotholder.h
 random.cpp
 random.h
-todo.txt
-)
\ No newline at end of file
+)
index 31b667db945942e1dfa874bfeb82c3a206703ecf..5f541f5bec64226716c40315cf2df121d688a7e3 100644 (file)
@@ -12,13 +12,4 @@ siox.cpp
 siox.h
 trace.cpp
 trace.h
-${trace_potrace_SRC}
 )
-# Add New folders in src folder here
-SET(tracefolders
-potrace
-)
-
-FOREACH(tracedirlist ${tracefolders})
-ADD_SUBDIRECTORY(${tracedirlist})
-ENDFOREACH(tracedirlist)
\ No newline at end of file
index a5ea14e8d0edd247d1b319d74be68b98772b5247..8edeb17159bdb9fe1067b5548c7df2b434e954ad 100644 (file)
@@ -13,19 +13,4 @@ stock.cpp
 stock.h
 stock-items.cpp
 stock-items.h
-${ui_cache_SRC}
-${ui_dialog_SRC}
-${ui_view_SRC}
-${ui_widget_SRC}
 )
-# Add New folders in src folder here
-SET(uifolders
-cache
-dialog
-view
-widget
-)
-
-FOREACH(uidirlist ${uifolders})
-ADD_SUBDIRECTORY(${uidirlist})
-ENDFOREACH(uidirlist)