How to set the LDFLAGS in CMakeLists.txt?
问题 I set the CFLAGS in CMake by CMAKE_C_FLAGS. Is something like this to set LDFLAGS? 回答1: It depends a bit on what you want: A) If you want to specify which libraries to link to, you can use find_library to find libs and then use link_directories and target_link_libraries to. Of course, it is often worth the effort to write a good find_package script, which nicely adds "imported" libraries with add_library( YourLib IMPORTED ) with correct locations, and platform/build specific pre- and suffixes