Hi,

A user of one of projects I maintain pointed out that according to
CMake guidelines [1] all variables with strings (also paths) should be
quoted, ie.

include_directories(${SOCI_SOURCE_DIR}/core)

should read

include_directories("${SOCI_SOURCE_DIR}/core")

Is that so?
What is the current CMake recommendation?

Some other guidelines [2] suggest rule of thumb when using
variables in COMMAND calls:
   Use quotes for the arguments that contain file paths

Does this apply to include_directories. set_target_properties, etc.?

I found "Paths with spaces - Visual Studio" [3] post which reports a
problem with not quoted paths but David Cole's recommendation [4]
uses add_library with path not quoted.

I sense, the answer to quote or not to quote might depend on
which CMake command is used.

Could anyone tell what is the current recommendation?

[1] 
https://cmake.org/Wiki/CMake/Language_Syntax#CMake_splits_arguments_unless_you_use_quotation_marks_or_escapes.
[2] https://stackoverflow.com/a/35853080/151641
[3] https://public.kitware.com/pipermail/cmake/2012-July/051138.html
[4] https://public.kitware.com/pipermail/cmake/2012-July/051139.html

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
-- 

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

Reply via email to