Err, I meant eval(some_func()) in the wrapper, not
eval(include(Module)). Sorry for the top-post, using
my phone.

If CMake had at least an eval() function, I could
append any of my modules included to a list and
then eval("include Module") for each
element in the list. But that's not possible.

While CMake does not have an eval function directly, this *is* effectively possible. The trick, though, is that you have to generate a script.cmake file (using file(WRITE or configure_file...) and then include *it*.

So, you could do something like:

   # assumes mod1.cmake and mod2.cmake already exist
   set(modules mod1.cmake mod2.cmake)
file(WRITE "${CMAKE_BINARY_DIR}/script.cmake" "") # file initially empty
   foreach(mod ${modules})
file(APPEND "${CMAKE_BINARY_DIR}/script.cmake" "include(\"${mod}\")\n")
   endforeach()
   include("${CMAKE_BINARY_DIR}/script.cmake")


HTH,
David

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to