From: acspike Date: Thu, 10 Apr 2008 04:48:40 +0000 (+0000) Subject: process source subdirectories with INCLUDE() instead of ADD_DIRECTORIES() X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2cdfe79be9449f74ac43a83b6ae7fb62f45c484b;p=inkscape.git process source subdirectories with INCLUDE() instead of ADD_DIRECTORIES() 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. --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f047198bb..aaf6bbe28 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,92 @@ +SET(INKSCAPE_SRC) + +# A macro to replace slashes and spaces in a string with underscores +MACRO(SANITIZE_PATH _string_var) + STRING(REGEX REPLACE "[\\/ ]+" "_" ${_string_var} ${${_string_var}}) +ENDMACRO(SANITIZE_PATH _string_var) + +# A macro to prepend a given string onto the beginning of each string in a list +MACRO(PREPEND _list _str) + SET(_temp_list ${${_list}}) + SET(${_list}) + FOREACH(x ${_temp_list}) + SET(${_list} ${${_list}} ${_str}${x}) + ENDFOREACH(x) +ENDMACRO(PREPEND _list _str) + +# All folder with CMakeLists.txt files (excluding internal libraries) +SET(srcfolders +algorithms +api +bind +debug +display +dom +dom/io +dom/odf +dom/util +dom/work +extension +extension/dxf2svg +extension/implementation +extension/internal +extension/param +graphlayout +helper +inkjar +io +jabber_whiteboard +jabber_whiteboard/dialog +live_effects +live_effects/parameter +pedro +removeoverlap +svg +trace +trace/potrace +traits +ui/cache +ui +ui/dialog +ui/view +ui/widget +utest +util +widgets +xml +) + +# 1) include each list file +# 2) grab the variable inside +# 3) prepend the full relative path to each file in list +# 4) append the list to INKSCAPE_SRC +FOREACH(dirlist ${srcfolders}) + SET(_temp_dirlist "${dirlist}") + MESSAGE(STATUS "Processing ${CMAKE_CURRENT_SOURCE_DIR}/${dirlist}/CMakeLists.txt") + INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/${dirlist}/CMakeLists.txt) + SANITIZE_PATH(dirlist) + PREPEND(${dirlist}_SRC "${_temp_dirlist}/") + SET(INKSCAPE_SRC ${INKSCAPE_SRC} ${${dirlist}_SRC}) +ENDFOREACH(dirlist) + + +# All directories containing lists files that describe building internal libraries +SET(libfolders +application +dialogs +libavoid +libcola +libcroco +libgdl +libnr +libnrtype +libvpsc +) + +FOREACH(dirlist ${libfolders}) + ADD_SUBDIRECTORY(${dirlist}) +ENDFOREACH(dirlist) + IF(WIN32) SET(ONLY_WIN registrytool.cpp @@ -7,6 +96,7 @@ SET(ONLY_WIN) ENDIF(WIN32) SET(INKSCAPE_SRC +${INKSCAPE_SRC} arc-context.cpp attributes.cpp axis-manip.cpp @@ -208,31 +298,6 @@ version.cpp winmain.cpp zoom-context.cpp ${ONLY_WIN} -${algorithms} -${api} -${application} -${BIND_SRC} -${debug} -${dialogs} -${display} -${dom_SRC} -${extension_SRC} -${graphlayout_SRC} -${extension_SRC} -${helper_SRC} -${inkjar_SRC} -${io_SRC} -${jabber_whiteboard_SRC} -${live_effects_SRC} -${removeoverlap_SRC} -${svg_SRC} -${trace_SRC} -${traits_SRC} -${ui_SRC} -#${utest_SRC} -#${util_SRC} -#${widgets_SRC} -#${xml_SRC} ) # make executable for INKSCAPE @@ -252,47 +317,3 @@ TARGET_LINK_LIBRARIES(inkscape #CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/INKSCAPE.pc.in # ${CMAKE_BINARY_DIR}/INKSCAPE.pc @ONLY IMMEDIATE ) #INSTALL(FILES "${CMAKE_BINARY_DIR}/INKSCAPE.pc" DESTINATION lib/pkgconfig) - - -# Add New folders in src folder here -SET(srcfolders -2geom -algorithms -api -application -bind -debug -dialogs -display -dom -extension -graphlayout -helper -inkjar -io -jabber_whiteboard -libavoid -libcola -libcroco -libgdl -libnr -libnrtype -libvpsc -livarot -live_effects -pedro -svg -pixmaps -trace -traits -ui -removeoverlap -utest -util -widgets -xml -) - -FOREACH(dirlist ${srcfolders}) -ADD_SUBDIRECTORY(${dirlist}) -ENDFOREACH(dirlist) diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt index 84ac8b19a..e6dfe1105 100644 --- a/src/api/CMakeLists.txt +++ b/src/api/CMakeLists.txt @@ -1,3 +1,3 @@ SET(api -inkscape.idl +api/inkscape.idl ) diff --git a/src/bind/CMakeLists.txt b/src/bind/CMakeLists.txt index c56bbd05d..bc52a6462 100644 --- a/src/bind/CMakeLists.txt +++ b/src/bind/CMakeLists.txt @@ -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 -) - -FOREACH(binddirlist ${bindfolders}) -ADD_SUBDIRECTORY(${binddirlist}) -ENDFOREACH(binddirlist) diff --git a/src/debug/CMakeLists.txt b/src/debug/CMakeLists.txt index 8e76dda4e..88406d4c7 100644 --- a/src/debug/CMakeLists.txt +++ b/src/debug/CMakeLists.txt @@ -1,4 +1,4 @@ -SET(debug +SET(debug_SRC demangle.cpp #demangle.h #event.h diff --git a/src/display/CMakeLists.txt b/src/display/CMakeLists.txt index b0f9b1dc8..71245d3ab 100644 --- a/src/display/CMakeLists.txt +++ b/src/display/CMakeLists.txt @@ -1,4 +1,4 @@ -SET(display +SET(display_SRC bezier-utils.cpp bezier-utils-test.cpp canvas-arena.cpp diff --git a/src/dom/CMakeLists.txt b/src/dom/CMakeLists.txt index 5f0cea63b..503f9d0cc 100644 --- a/src/dom/CMakeLists.txt +++ b/src/dom/CMakeLists.txt @@ -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 -) - -FOREACH(domdirlist ${domfolders}) -ADD_SUBDIRECTORY(${domdirlist}) -ENDFOREACH(domdirlist) - diff --git a/src/dom/odf/CMakeLists.txt b/src/dom/odf/CMakeLists.txt index fd1e49b85..7a4b1ea4e 100644 --- a/src/dom/odf/CMakeLists.txt +++ b/src/dom/odf/CMakeLists.txt @@ -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 ) diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt index f6ee9e3ec..56781f909 100644 --- a/src/extension/CMakeLists.txt +++ b/src/extension/CMakeLists.txt @@ -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 -) - -FOREACH(extensiondirlist ${extensionfolders}) -ADD_SUBDIRECTORY(${extensiondirlist}) -ENDFOREACH(extensiondirlist) - diff --git a/src/extension/internal/CMakeLists.txt b/src/extension/internal/CMakeLists.txt index ada17b480..7125d2e1c 100644 --- a/src/extension/internal/CMakeLists.txt +++ b/src/extension/internal/CMakeLists.txt @@ -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 -) - -FOREACH(extensionINTdirlist ${extensioninternalfolders}) -ADD_SUBDIRECTORY(${extensionINTdirlist}) -ENDFOREACH(extensionINTdirlist) - diff --git a/src/extension/param/CMakeLists.txt b/src/extension/param/CMakeLists.txt index 8ac3211f2..843de8b7a 100644 --- a/src/extension/param/CMakeLists.txt +++ b/src/extension/param/CMakeLists.txt @@ -3,7 +3,7 @@ bool.cpp color.cpp description.cpp enum.cpp -eter.cpp +parameter.cpp float.cpp int.cpp notebook.cpp diff --git a/src/jabber_whiteboard/CMakeLists.txt b/src/jabber_whiteboard/CMakeLists.txt index 8d5b56d89..abc15601b 100644 --- a/src/jabber_whiteboard/CMakeLists.txt +++ b/src/jabber_whiteboard/CMakeLists.txt @@ -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 diff --git a/src/live_effects/CMakeLists.txt b/src/live_effects/CMakeLists.txt index f88e96531..f7a3f7798 100644 --- a/src/live_effects/CMakeLists.txt +++ b/src/live_effects/CMakeLists.txt @@ -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) diff --git a/src/live_effects/parameter/CMakeLists.txt b/src/live_effects/parameter/CMakeLists.txt index e3292f3a0..4c429e586 100644 --- a/src/live_effects/parameter/CMakeLists.txt +++ b/src/live_effects/parameter/CMakeLists.txt @@ -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 +) diff --git a/src/trace/CMakeLists.txt b/src/trace/CMakeLists.txt index 31b667db9..5f541f5be 100644 --- a/src/trace/CMakeLists.txt +++ b/src/trace/CMakeLists.txt @@ -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 diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index a5ea14e8d..8edeb1715 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -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)