<div dir="ltr"><div><div>Hi Owen.<br><br></div>As a sanity check, the definition of the macro in the toplevel CMakeList comes *before* the add_subdirectory() command for the one which errors out, right?<br><br></div>Petr<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 14, 2016 at 8:25 AM, Owen Hogarth II <span dir="ltr"><<a href="mailto:gurenchan@gmail.com" target="_blank">gurenchan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I am trying to use a macro to enable c99 in some of my cmake modules.<div><br></div><div>In the top level cmake file I add this macro</div><div><br></div><div><div>macro(use_c99)</div><div>  if (CMAKE_VERSION VERSION_LESS "3.1")</div><div>    if (CMAKE_C_COMPILER_ID STREQUAL "GNU")</div><div>      set (CMAKE_C_FLAGS "--std=gnu99 ${CMAKE_C_FLAGS}")</div><div>    endif ()</div><div>  else ()</div><div>    set (CMAKE_C_STANDARD 99)</div><div>  endif ()</div><div>endmacro(use_c99)</div></div><div><br></div><div>then in another CMakeLists.txt file I add </div><div>use_c99()</div><div><br></div><div>but I get this error:</div><div><br></div><div><div>CMake Error at source/internal_src/cube/CMakeLists.txt:1 (use_c</div><div>99):</div><div>  Unknown CMake command "use_c99".</div><div><br></div><div>why am I unable to use the macro? My main cmake is using 3.0.2 from debian repository.</div><div><br></div></div></div>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div>