Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cmake GNUInstallDirs variables empty

Tags:

cmake

When trying to compile my project using cmake ., variable CMAKE_INSTALL_LIBDIR is empty and I have no idea why.

I'm trying to issue the following (on line 40):

install(TARGETS fpthread
    EXPORT fpthread_config
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

I get the following error message:

CMake Error at CMakeLists.txt:40 (install):
  install TARGETS given no LIBRARY DESTINATION for shared library target
  "fpthread".

Issuing the following results in an empty string:

MESSAGE(STATUS ${CMAKE_INSTALL_LIBDIR})

I've tried both Cmake 3.5 (installed through package manager) and Cmake 3.11 (latest release, compiled from source).

like image 230
João Neto Avatar asked Aug 30 '26 00:08

João Neto


1 Answers

Reformulating my previous comment as answer:

To access variables from the GNUInstallDirs module you need to add

include(GNUInstallDirs)

to your CMakeLists.txt file. The module is not included by default.

like image 123
vre Avatar answered Sep 03 '26 03:09

vre



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!