Standard way of knowing if find_package defines INCLUDE_DIR or INCLUDE_DIRS

Viewed 1626

I keep running into this problem with cmake when trying to write build files. the find_package command is supposed to define variables to be used with the include_directories directive, but it does so inconsistently. For example, consider the following code:

find_package(OpenGL REQUIRED)
find_package(glm REQUIRED)

message(STATUS ${GLM_INCLUDE_DIR})
message(STATUS ${GLM_INCLUDE_DIRS})
message(STATUS ${OPENGL_INCLUDE_DIR})
message(STATUS ${OPENGL_INCLUDE_DIRS})

Only the second and third message prints, even though one is "DIR" and the other is "DIRS"

Is there a standard way of determining which one you're supposed to use?

1 Answers
Related