Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use <code>target_link_libraries(myexecutable mylib)</code> to link to the library "mylib". The compiler will use its default way to find the specified library (e.g. it will look for libmylib.a on Linux). The compiler will only look in the <code>link_directories(directory1 directory2 ...)</code>, so you could try that command to add the required directories to the search path.</p> <p>When "mylib" is also compiled with CMake this will be recognized and everything should work automatically.</p> <p>When you want the user to specify a directory you can use a cached CMake variable. <code>set(MYPATH "NOT-DEFINED" CACHE PATH "docstring")</code>.</p> <p>For more complex stuff it is very advisable to write a CMake find module that can be used with <code>find_package</code>. I suggest you take a look at the <code>FindALSA.cmake</code> which can be used as a good starting point.</p> <p>The interesting part is at the end:</p> <pre><code>if(ALSA_FOUND) set( ALSA_LIBRARIES ${ALSA_LIBRARY} ) set( ALSA_INCLUDE_DIRS ${ALSA_INCLUDE_DIR} ) endif() mark_as_advanced(ALSA_INCLUDE_DIR ALSA_LIBRARY) </code></pre> <p>The <code>ALSA_LIBRARY</code> and <code>ALSA_INCLUDE_DIR</code> variables are user configurable and stored in the cache, while <code>ALSA_LIBRARIES</code> and <code>ALSA_INCLUDE_DIRS</code> as well as <code>ALSA_FOUND</code> get computed and are the ones that the user of the find module is supposed to use.</p> <p>Typically one would use the find module like this:</p> <pre><code>find_package(ALSA REQUIRED) include_directories(${ALSA_INCLUDE_DIRS}) target_link_libraries(myexe ${ALSA_LIBRARIES}) </code></pre> <p>I'm sure you can adapt this for your personal library.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload