<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 style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(40, 254, 20); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">CMake Error at src/include/record/CMakeLists.txt:28 (target_include_directories):</span></div><div style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(40, 254, 20); background-color: rgba(0, 0, 0, 0.901961);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  Cannot specify include directories for imported target "portaudio".</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">is the problem that externalProject_add only is executed when make is executed and not when cmake is executed’?</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">what is `portaudio` here referring to?</span></div><div><blockquote type="cite" class=""><div class="">Den 29. okt. 2017 kl. 02.19 skrev Craig Scott <<a href="mailto:craig.scott@crascit.com" class="">craig.scott@crascit.com</a>>:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sun, Oct 29, 2017 at 10:36 AM, Carlton Banks <span dir="ltr" class=""><<a href="mailto:noflaco@gmail.com" target="_blank" class="">noflaco@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">I seem to have some problems executing one of my submodules cmakelist.<br class="">
<br class="">
MESSAGE(“In record CMAKELIST”)<br class="">
<br class="">
# Include externalproject {portaudio} if lib/portaudio don't exist.<br class="">
MESSAGE(“Download external project”)<br class="">
<br class="">
INCLUDE(ExternalProject)<br class="">
ExternalProject_Add(project_<wbr class="">portaudio<br class="">
    GIT_REPOSITORY      <a href="https://git.assembla.com/portaudio.git" rel="noreferrer" target="_blank" class="">https://git.assembla.com/<wbr class="">portaudio.git</a><br class="">
    PREFIX              lib/portaudio<br class="">
    CONFIGURE_COMMAND   <SOURCE_DIR>/configure<br class="">
    BUILD_IN_SOURCE     1<br class="">
    BUILD_COMMAND       make<br class="">
    INSTALL_COMMAND     sudo make install<br class="">
)<br class="">
ExternalProject_Get_Property(<wbr class="">project_portaudio BINARY_DIR)<br class="">
ExternalProject_Get_Property(<wbr class="">project_portaudio SOURCE_DIR)<br class="">
<br class="">
SET(portaudio_lib_dir "${BINARY_DIR}/lib/.libs")<br class="">
SET(portaudio_inc_dir "${SOURCE_DIR}/include")<br class="">
<br class="">
add_library(record STATIC record.cpp record.h)<br class="">
add_library(libaudio libportaudio.a PATHS ${portaudio_lib_dir})<br class=""></blockquote><div class=""><br class=""></div><div class="">What is this second add_library() command intended to do? I'm guessing you probably instead want to be doing something like this (untested, but hopefully in the ballpark):</div><div class=""><br class=""></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">add_library(portaudio STATIC IMPORTED)</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div class="">set_target_properties(portaudio PROPERTIES</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div class="">    IMPORTED_LOCATION ${BINARY_DIR}/lib/.libs/libportaudio.a</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div class="">)</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div class="">target_include_directories(portaudio INTERFACE</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div class="">    ${SOURCE_DIR}/include</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div class="">)</div></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">add_dependencies(portaudio project_portaudio)     # Not sure if this is allowed for imported targets though</div></div></div></blockquote><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><div class="">I don't recall off the top of my head whether STATIC IMPORTED or INTERFACE IMPORTED would be the right way to call add_library() in the above, so try the latter if the former doesn't work for you. </div><div class=""><br class=""></div><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br class="">
<br class="">
<br class="">
#<br class="">
# this makes sure we have compiler flags that allow class::class() = default (>= C++11)<br class="">
target_compile_features(record PUBLIC cxx_defaulted_functions)<br class="">
<br class="">
<br class="">
<br class="">
<br class="">
target_include_directories(<wbr class="">record PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${project_portaudio})<br class=""></blockquote><div class=""><br class=""></div><div class="">You won't need this if you define the portaudio imported library as per my example above.</div><div class=""><br class=""></div><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br class="">
<br class="">
It cannot find libportaudio.a as externalproject_add() is not being executed, the command it executes add_library, which fails as the project has not been downloaded…<br class="">
<br class="">
<br class="">
what is wrong here?<br class=""></blockquote><div class=""><br class=""></div><div class="">The reason for this specific problem is that there's no dependency relationship between the project_<wbr class="">portaudio target defined by the ExternalProject_Add() call and the record target. Such a relationship is only created through a suitable call to target_link_libraries() or add_dependencies(), or through arguments like DEPENDS for commands that offer such features (e.g. add_custom_target() and add_custom_command()).</div></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class="">Craig Scott<br class=""><div class="">Melbourne, Australia</div><div class=""><a href="https://crascit.com/" target="_blank" class="">https://crascit.com</a><br class=""></div></div></div></div></div></div></div>
</div></div>
</div></blockquote></div><br class=""></body></html>