Hey Kristian,
as the documentation
https://github.com/Kitware/CMake/blob/master/Modules/FindFreetype.cmake
at line 21 states, FREETYPE_DIR is an environment variable.
So, if you change your line
set(FREETYPE_DIR "/home/kristian/Documents/freetype/freetype")
to
set(ENV{FREETYPE_DIR} "/home/kristian/Documents/freetype/freetype")
I would assume, your script will work.
Hth,
Andreas
Am 07.06.2016 um 22:47 schrieb Kristian:
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...
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake