<div dir="ltr"><div dir="ltr" class="gmail_msg">>> <span style="color:rgb(33,33,33)" class="gmail_msg">One possibility is the often mentioned superbuild</span><div class="gmail_msg"><span style="color:rgb(33,33,33)" class="gmail_msg"><br class="gmail_msg"></span></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><span style="color:rgb(33,33,33)" class="gmail_msg">That is a tempting and I started to go down that route - however, I ran into a problem where my project (which is now also built using ExternalProject_Add) does not have access to the CMake variables. Is the only solution to pass them through the CMAKE_ARGS variable in ExternalProject_Add?</span></div></div><br class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Mon, Jan 9, 2017 at 12:07 AM Hendrik Sattler <<a href="mailto:post@hendrik-sattler.de" class="gmail_msg" target="_blank">post@hendrik-sattler.de</a>> wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">One possibility is the often mentioned superbuild, another is not using find_library() but setting the variables with the library file paths manually (that's static info anyway).<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Am 8. Januar 2017 22:49:52 MEZ schrieb Saad Khattak <<a href="mailto:saadrustam@gmail.com" class="gmail_msg" target="_blank">saadrustam@gmail.com</a>>:<br class="gmail_msg">
>Hello,<br class="gmail_msg">
><br class="gmail_msg">
>I have an external project glfw that I added to my project like this:<br class="gmail_msg">
><br class="gmail_msg">
>==========<br class="gmail_msg">
>include(ExternalProject)<br class="gmail_msg">
>ExternalProject_Add(glfw<br class="gmail_msg">
>  GIT_REPOSITORY "<a href="https://github.com/glfw/glfw.git" rel="noreferrer" class="gmail_msg" target="_blank">https://github.com/glfw/glfw.git</a>"<br class="gmail_msg">
>  GIT_TAG "master"<br class="gmail_msg">
><br class="gmail_msg">
>  SOURCE_DIR "${CMAKE_SOURCE_DIR}/dep/glfw"<br class="gmail_msg">
>  CMAKE_ARGS -DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_TESTS=OFF<br class="gmail_msg">
>-DGLFW_BUILD_EXAMPLES=OFF<br class="gmail_msg">
>-DCMAKE_INSTALL_PREFIX=${CMAKE_SOURCE_DIR}/install/glfw/<br class="gmail_msg">
>-DCMAKE_DEBUG_POSTFIX=_d<br class="gmail_msg">
><br class="gmail_msg">
>  TEST_COMMAND ""<br class="gmail_msg">
>  )<br class="gmail_msg">
>set(GLFW_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/install/glfw/include/")<br class="gmail_msg">
>set(GLFW_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/install/glfw/lib/")<br class="gmail_msg">
>==========<br class="gmail_msg">
><br class="gmail_msg">
>Then I include it in my project like so:<br class="gmail_msg">
><br class="gmail_msg">
>==========<br class="gmail_msg">
>find_library(GLFW_LIB_D  glfw3_d ${GLFW_LIBRARY_DIR})<br class="gmail_msg">
>find_library(GLFW_LIB    glfw3   ${GLFW_LIBRARY_DIR})<br class="gmail_msg">
><br class="gmail_msg">
>include_directories(${GLFW_INCLUDE_DIR})<br class="gmail_msg">
><br class="gmail_msg">
>add_executable(vk_test<br class="gmail_msg">
>  src/vulkan_test.cpp<br class="gmail_msg">
>  )<br class="gmail_msg">
>target_link_libraries(vk_test debug ${GLFW_LIB_D} optimized<br class="gmail_msg">
>${GLFW_LIB})<br class="gmail_msg">
>add_dependencies(vk_test glfw)<br class="gmail_msg">
>==========<br class="gmail_msg">
><br class="gmail_msg">
>As you can see, I depend on the libraries compiled by the external<br class="gmail_msg">
>project<br class="gmail_msg">
>glfw. Unfortunately, when I first configure the project, CMake<br class="gmail_msg">
>complains<br class="gmail_msg">
>that it cannot find the libraries specified by ${GLFW_LIB_D} and<br class="gmail_msg">
>${GLFW_LIB} variables.<br class="gmail_msg">
><br class="gmail_msg">
>Of course, this is because CMake did not begin cloning, configuring and<br class="gmail_msg">
>building the glfw project. That only happens AFTER my project has been<br class="gmail_msg">
>configured and starts building. This becomes a chicken and the egg<br class="gmail_msg">
>problem.<br class="gmail_msg">
><br class="gmail_msg">
>Currently, my solution is to add dummy .lib files so that I can at<br class="gmail_msg">
>least<br class="gmail_msg">
>configure and generate my project. My question is, am I approaching<br class="gmail_msg">
>this<br class="gmail_msg">
>problem in the wrong way? If yes, what is the correct way to add a<br class="gmail_msg">
>dependency to an external project and have it clone/configure/build<br class="gmail_msg">
>BEFORE<br class="gmail_msg">
>the "find_library" call?<br class="gmail_msg">
<br class="gmail_msg">
--<br class="gmail_msg">
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.<br class="gmail_msg">
</blockquote></div></div>