c++ - cmake target_link_libraries() launching error Cannot specify link libraries for target "debug" -
i'm trying link clion , sfml (using windows, mingw w64, sfml 64, cmake) , triied configure cmakelists.txt properly.
here's cmakelist :
cmake_minimum_required(version 3.2) project(test_utilisation_sfml) set(cmake_cxx_flags "${cmake_cxx_flags} -std=c++11") set(source_files main.cpp) set(cmake_runtime_output_directory "${cmake_current_source_dir}/bin") message(warning "cmake runtime output directory : ${cmake_runtime_output_directory}") add_executable(test_utilisation_sfml.exe ${source_files}) # detect , add sfml set(cmake_module_path "${cmake_source_dir}/cmake_modules" ${cmake_module_path}) #find version 2.x of sfml #see findsfml.cmake file additional details , instructions find_package(sfml 2 required system window graphics network audio) if(sfml_found) include_directories(${sfml_include_dir}) message (warning "lib dir : ${sfml_include_dir}") message (warning "libs : ${sfml_libraries}") target_link_libraries(${executable_name} ${sfml_libraries}) message(warning "line not appear because fails previous line") endif()
and here's output of cmake :
error:cannot specify link libraries target "debug" not built project. warning:cmake runtime output directory : d:/jetbrains/workspace/c++/test utilisation sfml/bin warning:lib dir : c:/lib/sfml/sfml-2.3/include warning:libs : debug;c:/lib/sfml/sfml-2.3/lib/libsfml-system-d.a;optimized;c:/lib/sfml/sfml-2.3/lib/libsfml-system.a;debug;c:/lib/sfml/sfml-2.3/lib/libsfml-window-d.a;optimized;c:/lib/sfml/sfml-2.3/lib/libsfml-window.a;debug;c:/lib/sfml/sfml-2.3/lib/libsfml-graphics-d.a;optimized;c:/lib/sfml/sfml-2.3/lib/libsfml-graphics.a;debug;c:/lib/sfml/sfml-2.3/lib/libsfml-network-d.a;optimized;c:/lib/sfml/sfml-2.3/lib/libsfml-network.a;debug;c:/lib/sfml/sfml-2.3/lib/libsfml-audio-d.a;optimized;c:/lib/sfml/sfml-2.3/lib/libsfml-audio.a
i honnestly found weird see "debug" target, changed findsfml.cmake file make it
debug c:/lib/sfml/sfml-2.3/lib/libsfml-system-d.a
but didn't change anything. began earlier, noticed put "add_executable" after target_link_libraries command changed that, error didn't better.
i didn't put flag (like -lsfml-graphics etc) don't build (i can't, more precisely.) set_cmake_runtime_output_directory here force output in bin folder of project, instead of in clion directory.
executable_name
not set in target_link_libraries command, in debug build
target_link_libraries(${executable_name} ${sfml_libraries})
is expanded
target_link_libraries(debug path/to/debug/library optimized path/to/release/library ... )
the first argument treated target name see error
error:cannot specify link libraries target "debug" not built project
Comments
Post a Comment