# Disallow in-source builds
if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
message(FATAL_ERROR
"In-source builds are not permitted! Make a separate folder for"
" building, e.g.,\n"
" cmake -E make_directory build\n"
" cmake -E chdir build cmake ..\n"
"Before that, remove the files created by this failed run with\n"
" cmake -E remove CMakeCache.txt\n"
" cmake -E remove_directory CMakeFiles")
endif ()
一直在freetype源目录下执行cmake -G"MinGW Makefiles" ,就是不成功因为CMakeLists.txt有以上代码防止编译污染源码。
PS D:\projectcode\freetype1\freetype-2.10.1> cmake -G"MinGW Makefiles"
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.
-- The C compiler identification is GNU 8.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:162 (message):
In-source builds are not permitted! Make a separate folder for building,
e.g.,
cmake -E make_directory build
cmake -E chdir build cmake ..
Before that, remove the files created by this failed run with
cmake -E remove CMakeCache.txt
cmake -E remove_directory CMakeFiles
-- Configuring incomplete, errors occurred!
See also "D:/projectcode/freetype1/freetype-2.10.1/CMakeFiles/CMakeOutput.log".
PS D:\projectcode\freetype1\freetype-2.10.1> cmake -G"MinGW Makefiles"
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.
-- The C compiler identification is GNU 8.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:162 (message):
In-source builds are not permitted! Make a separate folder for building,
e.g.,
cmake -E make_directory build
cmake -E chdir build cmake ..
Before that, remove the files created by this failed run with
cmake -E remove CMakeCache.txt
cmake -E remove_directory CMakeFiles
-- Configuring incomplete, errors occurred!
See also "D:/projectcode/freetype1/freetype-2.10.1/CMakeFiles/CMakeOutput.log".
PS D:\projectcode\freetype1\freetype-2.10.1> cmake -G"MinGW Makefiles"
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.
-- The C compiler identification is GNU 8.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:162 (message):
In-source builds are not permitted! Make a separate folder for building,
e.g.,
cmake -E make_directory build
cmake -E chdir build cmake ..
Before that, remove the files created by this failed run with
cmake -E remove CMakeCache.txt
cmake -E remove_directory CMakeFiles
-- Configuring incomplete, errors occurred!
See also "D:/projectcode/freetype1/freetype-2.10.1/CMakeFiles/CMakeOutput.log".
必须建立一个build文件夹,在build里面执行freetype-2.10.1文件夹中的CMakeLists.txt,如cmake -G"MinGW Makefiles" …/
PS D:\projectcode\freetype1\freetype-2.10.1> cd build
PS D:\projectcode\freetype1\freetype-2.10.1\build> cmake -G"MinGW Makefiles" ../
-- The C compiler identification is GNU 8.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Warning at CMakeLists.txt:191 (find_package):
By not providing "FindHarfBuzz.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "HarfBuzz",
but CMake did not find one.
Could not find a package configuration file provided by "HarfBuzz"
(requested version 1.3.0) with any of the following names:
HarfBuzzConfig.cmake
harfbuzz-config.cmake
Add the installation prefix of "HarfBuzz" to CMAKE_PREFIX_PATH or set
"HarfBuzz_DIR" to a directory containing one of the above files. If
"HarfBuzz" provides a separate development package or SDK, be sure it has
been installed.
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Could NOT find BZip2 (missing: BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
-- Configuring done
CMake Error at CMakeLists.txt:355 (add_library):
Cannot find source file:
builds/windows/ftdebug.c
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .ispc
CMake Error at CMakeLists.txt:355 (add_library):
No SOURCES given to target: freetype
CMake Generate step failed. Build files cannot be regenerated correctly.
PS D:\projectcode\freetype1\freetype-2.10.1\build> cmake -G"MinGW Makefiles" ../
-- The C compiler identification is GNU 8.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Warning (dev) at E:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message):
The package name passed to `find_package_handle_standard_args` (PkgConfig)
does not match the name of the calling package (HarfBuzz). This can lead
to problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
E:/Program Files/CMake/share/cmake-3.19/Modules/FindPkgConfig.cmake:67 (find_package_handle_standard_args)
builds/cmake/FindHarfBuzz.cmake:33 (include)
CMakeLists.txt:191 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
CMake Warning (dev) at E:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message):
The package name passed to `find_package_handle_standard_args` (harfbuzz)
does not match the name of the calling package (HarfBuzz). This can lead
to problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
builds/cmake/FindHarfBuzz.cmake:62 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:191 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Could NOT find harfbuzz (missing: HARFBUZZ_INCLUDE_DIRS HARFBUZZ_LIBRARIES)
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Could NOT find BZip2 (missing: BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
-- Configuring done
-- Generating done
-- Build files have been written to: D:/projectcode/freetype1/freetype-2.10.1/build
PS D:\projectcode\freetype1\freetype-2.10.1\build> make
Scanning dependencies of target freetype
[ 2%] Building C object CMakeFiles/freetype.dir/src/autofit/autofit.c.obj
[ 4%] Building C object CMakeFiles/freetype.dir/src/base/ftbase.c.obj
[ 7%] Building C object CMakeFiles/freetype.dir/src/base/ftbbox.c.obj
[ 9%] Building C object CMakeFiles/freetype.dir/src/base/ftbdf.c.obj
[ 11%] Building C object CMakeFiles/freetype.dir/src/base/ftbitmap.c.obj
[ 14%] Building C object CMakeFiles/freetype.dir/src/base/ftcid.c.obj
[ 16%] Building C object CMakeFiles/freetype.dir/src/base/ftfstype.c.obj
[ 19%] Building C object CMakeFiles/freetype.dir/src/base/ftgasp.c.obj
[ 21%] Building C object CMakeFiles/freetype.dir/src/base/ftglyph.c.obj
[ 23%] Building C object CMakeFiles/freetype.dir/src/base/ftgxval.c.obj
[ 26%] Building C object CMakeFiles/freetype.dir/src/base/ftinit.c.obj
[ 28%] Building C object CMakeFiles/freetype.dir/src/base/ftmm.c.obj
[ 30%] Building C object CMakeFiles/freetype.dir/src/base/ftotval.c.obj
[ 33%] Building C object CMakeFiles/freetype.dir/src/base/ftpatent.c.obj
[ 35%] Building C object CMakeFiles/freetype.dir/src/base/ftpfr.c.obj
[ 38%] Building C object CMakeFiles/freetype.dir/src/base/ftstroke.c.obj
[ 40%] Building C object CMakeFiles/freetype.dir/src/base/ftsynth.c.obj
[ 42%] Building C object CMakeFiles/freetype.dir/src/base/ftsystem.c.obj
[ 45%] Building C object CMakeFiles/freetype.dir/src/base/fttype1.c.obj
[ 47%] Building C object CMakeFiles/freetype.dir/src/base/ftwinfnt.c.obj
[ 50%] Building C object CMakeFiles/freetype.dir/src/bdf/bdf.c.obj
[ 52%] Building C object CMakeFiles/freetype.dir/src/bzip2/ftbzip2.c.obj
[ 54%] Building C object CMakeFiles/freetype.dir/src/cache/ftcache.c.obj
[ 57%] Building C object CMakeFiles/freetype.dir/src/cff/cff.c.obj
[ 59%] Building C object CMakeFiles/freetype.dir/src/cid/type1cid.c.obj
[ 61%] Building C object CMakeFiles/freetype.dir/src/gzip/ftgzip.c.obj
[ 64%] Building C object CMakeFiles/freetype.dir/src/lzw/ftlzw.c.obj
[ 66%] Building C object CMakeFiles/freetype.dir/src/pcf/pcf.c.obj
[ 69%] Building C object CMakeFiles/freetype.dir/src/pfr/pfr.c.obj
[ 71%] Building C object CMakeFiles/freetype.dir/src/psaux/psaux.c.obj
[ 73%] Building C object CMakeFiles/freetype.dir/src/pshinter/pshinter.c.obj
[ 76%] Building C object CMakeFiles/freetype.dir/src/psnames/psnames.c.obj
[ 78%] Building C object CMakeFiles/freetype.dir/src/raster/raster.c.obj
[ 80%] Building C object CMakeFiles/freetype.dir/src/sfnt/sfnt.c.obj
[ 83%] Building C object CMakeFiles/freetype.dir/src/smooth/smooth.c.obj
[ 85%] Building C object CMakeFiles/freetype.dir/src/truetype/truetype.c.obj
[ 88%] Building C object CMakeFiles/freetype.dir/src/type1/type1.c.obj
[ 90%] Building C object CMakeFiles/freetype.dir/src/type42/type42.c.obj
[ 92%] Building C object CMakeFiles/freetype.dir/src/winfonts/winfnt.c.obj
[ 95%] Building C object CMakeFiles/freetype.dir/builds/windows/ftdebug.c.obj
[ 97%] Building RC object CMakeFiles/freetype.dir/src/base/ftver.rc.obj
[100%] Linking C static library libfreetype.a
[100%] Built target freetype
PS D:\projectcode\freetype1\freetype-2.10.1\build>