Desidero che Cmake crei delle regole di installazione che installino automaticamente anche la configurazione e altre cose. Ho guardato this question, ma aggiungendo:Installazione di CMake: installazione dei file di configurazione
add_executable(solshare_stats.conf solshare_stats.conf)
al mio file CMakeLists.txt mi ha dato solo avvertimenti ed errori:
CMake Error: CMake can not determine linker language for target:solshare_stats.conf
CMake Error: Cannot determine link language for target "solshare_stats.conf".
...
make[2]: *** No rule to make target `CMakeFiles/solshare_stats.conf.dir/build'. Stop.
make[1]: *** [CMakeFiles/solshare_stats.conf.dir/all] Error 2
make: *** [all] Error 2
Come faccio ad aggiungere config, init e/o file di log a CMake installare le regole?
Ecco il mio file completo CMakeLists.txt:
project(solshare_stats)
cmake_minimum_required(VERSION 2.8)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
add_executable(solshare_stats.conf solshare_stats.conf)
target_link_libraries(solshare_stats mysqlcppconn)
target_link_libraries(solshare_stats wiringPi)
if(UNIX)
if(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_EXE_LINKER_FLAGS "-s")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall -std=c++0x")
endif()
install(TARGETS solshare_stats DESTINATION /usr/bin COMPONENT binaries)
install(TARGETS solshare_stats.conf DESTINATION /etc/solshare_stats COMPONENT config)
endif()
E cosa devo cambiare per le chiamate install() affinché funzioni? Perché con i comandi di installazione corrente() ottengo questo errore: 'installa TARGETS dato il target" solshare_stats.conf "che non esiste in questa directory. – Cheiron
Scusate - aggiungerò che! – Fraser
Fatto. A proposito, è normale passare un percorso relativo come argomento 'DESTINATION' in modo che il' CMAKE_INSTALL_PREFIX' sia onorato. – Fraser