Relative Content

Tag Archive for cmake

How can I get information about CMAKE project without running the compiler checks?

I am writing a script that will compile a few hundred applications using CMAKE. These applications use various compilers for embedded systems and each has it’s own build instructions. Usually we use compilers on shared network drive, but in order to speed things up I want to check which compiler should be used, cache it locally and override compiler settings via command line.

How to conditionally set compile definitions in cmake

if(“$<CONFIG:Debug>”) target_compile_definitions(Geodesic-RayTracer PRIVATE TESTING_ENABLED) endif() #target_compile_definitions(Geodesic-RayTracer PRIVATE TESTING_ENABLED) I have the above in my CMakeLists.txt for my project. If I uncomment the line below endif() my code has TESTING_ENABLED set. So I know that part is correct. However I only want to set it on Debug builds. The C++ pattern I’m trying to follow looks […]

How to find “link-name” of a library after it’s built with cmake?

I’m building a C++ project with CMakeLists.txt, that depends on some library, which is built in the build-process. I’ve used:
add_subdirectory(/path/to/some_lib)
that contains another CMakeLists.txt, that builds that library. In order to link I call:
target_link_libraries(${target} some_lib_name)
My question is:
how am I supposed to know what “some_lib_name” to use in target_link_libraries?

Test and compiler output

I would like to capture the output of CMake testing. Using Xcode, one can find a file named LastTest which includes most of what I want. But it seems to not include build/link failures. If a test fails to compile, nothing at all appears in the LastTest file.

CMake targets are not exported before add_subdirectory is called

I have an app, an interface library and plugins.
I define the targets in the main lists file.
Plugins are included using add_subdirectory(plugins).
I want plugins to be able to use find_package in the build and install tree.
I exported targets like this

Breaking long lines in CMakeLists.txt

I’ve seen a couple of posts suggesting that it’s possible to use to break long lines in CMakeLists.txt. But in my world it appears not to be true. Here’s my CMakeLists.txt:

CMake for FFTW3

I am able to build a simple application using a MakeFile with the contents…