[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft] CMakeLists.txt patch
From: |
Werner LEMBERG |
Subject: |
Re: [ft] CMakeLists.txt patch |
Date: |
Sun, 02 Aug 2015 18:53:09 +0200 (CEST) |
Hello John!
> To ensure not built shared on Windows, which does not work
> due to lack of declspec's. Adds versioning of shared libraries.
Thanks. This is now applied to the git repository, with slight
modifications.
> Adds creation of freetype-config on unix.
Below you can see what I currently have. Note that one central
variable in `freetype-config.in' is still missing: %LIBSTATIC_CONFIG%.
This exposes a weakness present in most `FindXXX.cmake' modules that
come with cmake itself: There is no support for getting the static
libraries necessary for linking.
I don't know how to handle this gracefully.
Additionally, I think it would be better if cmake doesn't generate the
script `freetype-config' but rather the pkg-config module
`freetype2.pc' (from `freetype2.in'). However, this leads to exactly
the same problem, namely getting a proper substitute for
`%REQUIRES_PRIVATE%'...
Werner
======================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index edcb64e..b3de1cf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -355,6 +355,34 @@ if (HARFBUZZ_FOUND)
endif ()
+# Create the `freetype-config' file
+if (UNIX)
+ message(STATUS
+ "Creating directory ${PROJECT_BINARY_DIR}/builds/unix")
+ file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/builds/unix")
+
+ message(STATUS
+ "Creating file ${PROJECT_BINARY_DIR}/builds/unix/freetype-config")
+
+ file(READ "${PROJECT_SOURCE_DIR}/builds/unix/freetype-config.in"
+ FREETYPE_CONFIG_IN)
+ string(REPLACE "%ft_version%" "${SHARED_LIBRARY_VERSION}"
+ FREETYPE_CONFIG_IN "${FREETYPE_CONFIG_IN}")
+ string(REPLACE "%prefix%" "${CMAKE_INSTALL_PREFIX}"
+ FREETYPE_CONFIG_IN "${FREETYPE_CONFIG_IN}")
+ string(REPLACE "%exec_prefix%" "${CMAKE_INSTALL_PREFIX}"
+ FREETYPE_CONFIG_IN "${FREETYPE_CONFIG_IN}")
+ string(REPLACE "%exec_prefix_set%" "no"
+ FREETYPE_CONFIG_IN "${FREETYPE_CONFIG_IN}")
+ string(REPLACE "%includedir%" "${CMAKE_INSTALL_PREFIX}/include"
+ FREETYPE_CONFIG_IN "${FREETYPE_CONFIG_IN}")
+ string(REPLACE "%libdir%" "${CMAKE_INSTALL_PREFIX}/lib"
+ FREETYPE_CONFIG_IN "${FREETYPE_CONFIG_IN}")
+ file(WRITE "${PROJECT_BINARY_DIR}/builds/unix/freetype-config"
+ "${FREETYPE_CONFIG_IN}")
+endif ()
+
+
# Installations
# Note the trailing slash in the argument to the `DIRECTORY' directive
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
@@ -368,6 +396,12 @@ install(FILES
${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h
DESTINATION include/freetype2/freetype/config
)
+if (UNIX)
+ install(PROGRAMS
+ ${PROJECT_BINARY_DIR}/builds/unix/freetype-config
+ DESTINATION bin
+ )
+endif ()
install(TARGETS freetype
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
- Re: [ft] CMakeLists.txt patch,
Werner LEMBERG <=