<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">(cc’ing Brad in case he can shed some light where my CMake-foo is limited)</div><div class=""><br class=""></div>This is curious… According to the CMake documentation marking the variable as PATH has no impact on the way it is expanded, it only impacts how the variable is displayed in ccmake and cmake-gui. Maybe someone more adept at CMake can explain how this is wrong.<div class=""><br class=""></div><div class="">In general passing in relative paths as CMake variables on the command line is pretty flaky because there is no guarantee what the path will expand relative to. Should it be relative to the CMAKE_BINARY_DIRECTORY which is probably the working directory when you run cmake, or the CMAKE_SOURCE_DIRECTORY, or the CMAKE_CURRENT_SOURCE_DIRECTORY?</div><div class=""><br class=""></div><div class="">The only feature of CMake that I’m aware of that are designed to help make relative paths work is CMAKE_USE_RELATIVE_PATHS (<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cmake.org_cmake_help_v3.0_variable_CMAKE-5FUSE-5FRELATIVE-5FPATHS.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=eqUDonXRDPNdV9N8wQ8Im-1otq_UvGHXSRJAYGEv3u4&s=6oj0AvgCa7dEDmF5Lbpb0HbN1D-Ab_Yp_5TmUDJJvUw&e=" class="">http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_USE_RELATIVE_PATHS.html</a>), which right in the documentation says “May not work!”, so I would strongly advise against using it, or using relative paths at all.</div><div class=""><br class=""></div><div class="">If setting PATH has no impact other than the ccmake UI, I don’t think we should have this change here. Instead I think if users want to display the variable as a path chooser they should specify the type when the call into CMake, because that is the only place this value can be set (i.e. -DLLVM_EXTERNAL_*_SOURCE_DIR:PATH=…).</div><div class=""><br class=""></div><div class="">If PATH does have some impact on how the value is expanded, I have no objection to this change, but it still feels odd.</div><div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On Jul 13, 2015, at 10:12 PM, NAKAMURA Takumi <<a href="mailto:geek4civic@gmail.com" class="">geek4civic@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Author: chapuni<br class="">Date: Tue Jul 14 00:12:53 2015<br class="">New Revision: 242120<br class=""><br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D242120-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=eqUDonXRDPNdV9N8wQ8Im-1otq_UvGHXSRJAYGEv3u4&s=Z7CuwZTyiE5DLM_BSacX152sok45baK9ghFoIoMvLkk&e=" class="">http://llvm.org/viewvc/llvm-project?rev=242120&view=rev</a><br class="">Log:<br class="">[CMake] Unbreak add_llvm_external_project when external projects are specified.<br class=""><br class="">LLVM_EXTERNAL_*_SOURCE_DIR is reset as PATH with set(CACHE PATH).<br class="">Then the CACHE PATH variable, LLVM_EXTERNAL_*_SOURCE_DIR, is normalized as<br class="">${CMAKE_SOURCE_DIR}/${path_var} if ${path_var} is relative.<br class=""><br class="">Modified:<br class=""> llvm/trunk/cmake/modules/AddLLVM.cmake<br class=""><br class="">Modified: llvm/trunk/cmake/modules/AddLLVM.cmake<br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_cmake_modules_AddLLVM.cmake-3Frev-3D242120-26r1-3D242119-26r2-3D242120-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=eqUDonXRDPNdV9N8wQ8Im-1otq_UvGHXSRJAYGEv3u4&s=qfk7eq2jVgGKEsOcILR0GXx4NCGDxu5xG-FjYcwZp2s&e=" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=242120&r1=242119&r2=242120&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)<br class="">+++ llvm/trunk/cmake/modules/AddLLVM.cmake Tue Jul 14 00:12:53 2015<br class="">@@ -696,6 +696,9 @@ macro(add_llvm_external_project name)<br class=""> endif()<br class=""> if(NOT LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR)<br class=""> set(LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${add_llvm_external_dir}")<br class="">+ else()<br class="">+ set(LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR<br class="">+ CACHE PATH "Path to ${name} source directory")<br class=""> endif()<br class=""> if (EXISTS ${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR}/CMakeLists.txt)<br class=""> option(LLVM_EXTERNAL_${nameUPPER}_BUILD<br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@cs.uiuc.edu" class="">llvm-commits@cs.uiuc.edu</a><br class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br class=""></div></blockquote></div><br class=""></div></body></html>