I find not so nice that CMake doesn't complain at all if some variables
are not defined.
Is there a way to make it complain if a variable used is actually blank?
In the meanwhile I ended up with this:
set(COMPULSORY_ARGUMENTS PSI)
set(OPTIONAL_ARGUMENTS WORKSPACE CONTAINER_PATHS)
macro (check_compulsory_variable var)
if (NOT DEFINED ${var})
message(FATAL_ERROR "variable ${var} is not defined")
endif ()
endmacro ()
macro (check_optional_variable var)
if (NOT DEFINED ${var})
message(WARNING "variable ${var} is not defined")
endif ()
endmacro ()
foreach (arg ${COMPULSORY_ARGUMENTS})
check_compulsory_variable(${arg})
endforeach ()
foreach (arg ${OPTIONAL_ARGUMENTS})
check_optional_variable(${arg})
endforeach ()
which is not great but it does the job.
Any better solutions?
--
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://www.cmake.org/mailman/listinfo/cmake