CMakeLists.txt Library path

CodeLite installation/troubleshooting forum
Dobrelius
CodeLite Curious
Posts: 3
Joined: Fri Aug 03, 2018 12:13 am
Genuine User: Yes
IDE Question: C++
Contact:

CMakeLists.txt Library path

Post by Dobrelius »

I'm trying to use CodeLite 12.04 to generate CMakeLists.txt files for processing with CMake 3.12. (CMake is then supposed to generate .build files for Ninja, which should call the clang-cl.exe compiler (version 7.0) and link with either VS 2015 link.exe or lld-link.exe, using the VS standard library.)

In my project I have some libraries that I have prebuilt in a seperate directory that I would like to link with the object files of the current project. In the IDE, project settings, linker, Libraries Search Path contains the path to the .lib files.

However, when I generate the CMakeLists.txt file the section under "# Library path" only contains a line like this:

Code: Select all

...
# Library path
set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} /LIBPATH:some-path /LIBPATH:  ........... ")

...
When I process this file with CMake, no LINK_PATH appear to be set and the build fails during linking because the libraries can not be found.

When I change the CMakeLists.txt file like this, the build works fine.

Code: Select all

...
# Library path
link_directories(
    some-path
    .......
)
...
I was unable to find any information about the CMAKE_LDFLAGS variable on the internet, the (current) CMAKE documentation doesn't seem to contain any reference to it.

Why was the CMAKE_LDFLAGS syntax chosen over the link_directories syntax and how is it supposed to work? What does it tie into?