c++ - CMake 'no rule to make target' with external library -
i trying link 1 of programs libevent. using cmake build system. project structure follows:
my_project ├── cmakelists.txt ├── readme.md ├── build │ └── build stuff └── software ├── readme.md ├── cmakelists.txt ├── include ├── libraries │ ├── libevent │ │ └── cmakelists.txt │ └── anotherlibrary │ └── cmakelists.txt ├── prog1 │ ├── cmakelists.txt ├── prog2 │ ├── cmakelists.txt └── prog3 └── cmakelists.txt cmakelist.txt of prog1 (the 1 that's needs linked libevent)
cmake_minimum_required(version 2.6) project (prog1) file(glob prog1 "*.h" "*.cpp" ) include_directories("${project_include_dir}/libevent/include") add_executable(${project_name} ${prog1}) target_link_libraries(${project_name} event_core) but when build project make can't find library build libevent. searched for: libraries/libevent/lib/libevent_core.a wrong path since libevent builds libs inside: my_project/build/software/libraries/libevent/lib/libevent_core.a
how tell cmake search there library? added following lines cmake file wasn't working
link_directories(/my_project/build/software/libraries/libevent/lib/) set(cmake_archive_output_directory ${cmake_source_dir}/build/lib) set(cmake_runtime_output_directory ${cmake_source_dir}/build/bin) anyone suggestion?
i fixed problem myself removing content build directory , re running cmake .. inside build directory.
i think cmake somehow not aware of changes made , rebuilding project problem fixed.
Comments
Post a Comment