On Mon, Dec 1, 2008 at 10:52 AM, cyril_wobow <span dir="ltr"><<a href="mailto:cyril@wobow.com">cyril@wobow.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
It's my understanding that you are trying to declare two "solutions" p1 and p2 (using visual studio's terminology).<br>
The source_group() calls affects the next "project" declaration (which is done with add_executable() or add_library()) in the cmake module where they occur .</blockquote></div><br>That is indeed how I would expect it to work, but that's not what is happening. Below is the actual CMake code I'm using to generate projects:<br>
<br><span style="font-family: courier new,monospace; color: rgb(0, 102, 0);">macro( component project_name )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> cmake_minimum_required( VERSION 2.6 )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> set_include_directories()</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> add_definitions( -DBOOST_ALL_NO_LIB )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> </span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> project( ${project_name}_test )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> file( GLOB_RECURSE testsrc test/*.[chi]pp )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> add_executable( ${project_name}_test ${testsrc} )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> else()</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> message( "WARNING: No unit test found for component vfx/${project_name}" )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> endif()</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> </span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> project( ${project_name} )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);"><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> file( GLOB_RECURSE inc RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.[chi]pp )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> file( GLOB_RECURSE src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} source/*.[chi]pp )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> </span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> foreach( file ${inc};${src} )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> get_filename_component( path ${file} PATH )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> string( REPLACE / \\ group ${path} )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> source_group( ${group} FILES ${file} )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> endforeach()</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 102, 0);">endmacro()</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);"><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 102, 0);">macro( library_component project_name )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> component( ${project_name} )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);">
<span style="font-family: courier new,monospace; color: rgb(0, 102, 0);"> add_library( ${project_name} STATIC ${inc};${src} )</span><br style="font-family: courier new,monospace; color: rgb(0, 102, 0);"><span style="font-family: courier new,monospace; color: rgb(0, 102, 0);">endmacro()</span><br>
<br>Inside of another CMakeLists.txt file in a different subdirectory, I'll call <b><span style="font-family: courier new,monospace;">library_component( ProjectName )</span></b>. Is this a bug in CMake or am I just doing this incorrectly? Help would be appreciated! Thank you.<br>