# do not build devel by default
ADD_SUBDIRECTORY( devel EXCLUDE_FROM_ALL )
ADD_SUBDIRECTORY( tools )
-#ADD_SUBDIRECTORY( examples )
+ADD_SUBDIRECTORY( examples )
ADD_SUBDIRECTORY( po EXCLUDE_FROM_ALL )
ADD_SUBDIRECTORY( doc )
ADD_SUBDIRECTORY( vendor )
-INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
-
-
-########### next target ###############
-
-SET(read_plaindir_source_SRCS
-read_plaindir_source.cc
-)
-
-ADD_EXECUTABLE(read_plaindir_source ${read_plaindir_source_SRCS})
+## ############################################################
+
+FILE( GLOB ALLCC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc" )
+STRING( REPLACE ".cc" ";" APLLPROG ${ALLCC} )
+FOREACH( loop_var ${APLLPROG} )
+ ADD_EXECUTABLE( ${loop_var}
+ ${loop_var}.cc
+ )
+ TARGET_LINK_LIBRARIES( ${loop_var}
+ zypp
+ )
+ENDFOREACH( loop_var )
+
+## ############################################################
--- /dev/null
+#include <iostream>
+
+#include <zypp/ZYpp.h>
+#include <zypp/ZYppFactory.h>
+#include <zypp/PathInfo.h>
+#include <zypp/Capability.h>
+#include <zypp/sat/Solvable.h>
+#include <zypp/sat/WhatProvides.h>
+
+int main(int argc, char **argv) {
+ zypp::ZYpp::Ptr zyppPtr = zypp::ZYppFactory::instance().getZYpp();
+
+ zypp::Pathname sysRoot( "/" );
+
+ zyppPtr->initializeTarget( sysRoot, false );
+ zyppPtr->target()->load();
+
+ std::cout << "Looking for packages which provide " << argv[1] << std::endl;
+ zypp::Capability cap(argv[1]);
+ zypp::sat::WhatProvides wp(cap);
+
+ if (wp.empty()) {
+ std::cout << "No providers of " << argv[1] << " found" << std::endl;
+ } else {
+ zypp::sat::Solvable package(*wp.begin());
+ std::cout << "Provided by " << package.name() << " version " << package.edition().version()
+ << std::endl;
+ }
+
+ return EXIT_SUCCESS;
+}