user3734515
user3734515

Reputation: 23

Debug make and cmake?

When I try to build an specific application using cmake 2.8.9, everything seems fine at first. cmake tells me that all the required header files and libraries are found, no errors. However, when I run make the build fails because of missing header files. These header files where found by cmake just seconds before running make.

I want to find out why cmake can find the file, but make cannot. How can I debug this?

Upvotes: 2

Views: 156

Answers (1)

Sounds like CMake "found" the headers by running a Find module, which finds files on disk and stores these in CMake variables. These variables must then be used to configure the targets defined in the CMakeList, and perhaps this step is missing in your CMakeList. Check all find_package() calls in the CMakeList and make sure their results are used where necessary.

Here's an example how that could look for a simple library (GLUT):

find_package(GLUT)  # find GLUT

include_directories(${GLUT_INCLUDE_DIR})  # use variable set up by find_package() call

add_target(MyGlutUsingProgram main.cpp)

target_link_libraries(${GLUT_LIBRARIES})  # use variable set up by find_package() call

Upvotes: 2

Related Questions