CMake install: installing config files -
i want cmake make install rules me automatically install configuration , other things. looked @ this question, adding:
add_executable(solshare_stats.conf solshare_stats.conf)
to cmakelists.txt file gave me warnings , errors:
cmake error: cmake can not determine linker language target:solshare_stats.conf cmake error: cannot determine link language target "solshare_stats.conf". ... make[2]: *** no rule make target `cmakefiles/solshare_stats.conf.dir/build'. stop. make[1]: *** [cmakefiles/solshare_stats.conf.dir/all] error 2 make: *** [all] error 2
how add config, init and/or logfiles cmake install rules?
here complete cmakelists.txt file:
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()
the .conf file should included in add_executable
define executable target, not in separate call:
add_executable(${project_name} ${src_list} solshare_stats.conf)
need use install(file ...)
rather install(target ...)
:
install(targets solshare_stats destination /usr/bin component binaries) install(files solshare_stats.conf destination etc/solshare_stats component config)
doing
add_executable(${project_name} ${src_list}) add_executable(solshare_stats.conf solshare_stats.conf)
you're saying want create 2 executables, 1 called "solshare_stats" , called "solshare_stats.conf".
the second target's source file actual file "solshare_stats.conf". since none of source files in target have suffix gives idea language (e.g ".cc" or ".cpp" implies c++, ".asm" implies assembler), no language can deduced, hence cmake error.
Comments
Post a Comment