Hi Owen. 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?
Petr On Thu, Jan 14, 2016 at 8:25 AM, Owen Hogarth II <gurenc...@gmail.com> wrote: > I am trying to use a macro to enable c99 in some of my cmake modules. > > In the top level cmake file I add this macro > > macro(use_c99) > if (CMAKE_VERSION VERSION_LESS "3.1") > if (CMAKE_C_COMPILER_ID STREQUAL "GNU") > set (CMAKE_C_FLAGS "--std=gnu99 ${CMAKE_C_FLAGS}") > endif () > else () > set (CMAKE_C_STANDARD 99) > endif () > endmacro(use_c99) > > then in another CMakeLists.txt file I add > use_c99() > > but I get this error: > > CMake Error at source/internal_src/cube/CMakeLists.txt:1 (use_c > 99): > Unknown CMake command "use_c99". > > why am I unable to use the macro? My main cmake is using 3.0.2 from debian > repository. > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake