[CMake] Freetype on linux systems in non-standard directories
Kristian
kristianonline28 at gmail.com
Tue Jun 7 16:47:42 EDT 2016
Hey guys,
I wanted to try something out with CMake and latest version of freetype
(2.6.3). So I downloaded freetype, compiled it with the commands
> ./configure --prefix=/home/kristian/Documents/freetype/freetype
> make
> make install
After that, I created a small C++-file and a CMakeLists.txt. The C++-file
depends on freetype, so my CMakeLists.txt looks like this:
=====
> cmake_minimum_required(VERSION 3.5)
> project(freetype_ex)
>
> set(FREETYPE_DIR "/home/kristian/Documents/freetype/freetype")
> find_package(Freetype)
>
> set(SOURCES main.cpp)
>
> include_directories(${FREETYPE_INCLUDE_DIRS})
>
> add_executable(${PROJECT_NAME} ${SOURCES})
> target_link_libraries(${PROJECT_NAME} ${FREETYPE_LIBRARIES})
=====
But when calling cmake, I am getting this error:
=====
> -- Could NOT find Freetype (missing: FREETYPE_LIBRARY
FREETYPE_INCLUDE_DIRS)
> CMake Error: The following variables are used in this project, but they
are set to NOTFOUND.
> Please set them or make sure they are set and tested correctly in the
CMake files:
> FREETYPE_LIBRARY (ADVANCED)
> linked by target "freetype_ex" in directory
/home/kristian/Documents/freetype/cmake
>
> -- Configuring incomplete, errors occurred!
> See also
"/home/kristian/Documents/freetype/cmake/CMakeFiles/CMakeOutput.log".
=====
This sort of error seems for me to be a bug, because I would assume, that
when I set the variable FREETYPE_DIR, then CMake would also look at this
dir.
I looked at the FindFreetype.cmake file (
https://github.com/Kitware/CMake/blob/master/Modules/FindFreetype.cmake)
and my first assumption is, that it would help, to add something like
${FREETYPE_DIR} the the find_path calls.
What do you think of this? Another idea is, to add another variable instead
of FREETYPE_DIR, e.g. FREETYPE_ROOT_DIR...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160607/9325a34b/attachment-0001.html>
More information about the CMake
mailing list