install FILES given no DESTINATION

  • We already specify the DESTINATION for FILES, but it reports install FILES given no DESTINATION
  1 get_filename_component(BASE_DIR "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE)
  2 
  3 set(AOE_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/aoe.ini)
  4 
  5 if(NOT EXISTS ${AOE_CONFIG})
  6     message(FATAL_ERROR "Cannot find config file ${AOE_CONFIG}.")
  7 endif()
  8 
  9 add_custom_target(aoe_conf
 10     COMMAND ${CMAKE_COMMAND} -E copy ${AOE_CONFIG} ${CMAKE_CURRENT_BINARY_DIR}
 11 )
 12 
 13 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/aoe.ini
 14     OPTIONAL DESTINATION ${INSTALL_LIBRARY_DIR}
 15 )
  • detail error info when i config it with cmake …/
CMake Error at aoe/config/CMakeLists.txt:13 (install):
  install FILES given no DESTINATION!

Oh, shoud add -DINSTALL_LIBRARY_DIR=zyd when confg it with cmake …/

eg: cmake …/ -DINSTALL_LIBRARY_DIR=zyd

and include GNUInstallDirs module before.

hi @ClausKlein does it something like following when you suggest use CMAKE_INSTALL_LIBDIR ?

13 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/aoe.ini
14 OPTIONAL DESTINATION ${CMAKE_INSTALL_LIBDIR}
15 )

yes