Am Thu, 18 Mar 2021 11:01:31 +0100
schrieb Kornel Benko <[email protected]>:

> > Please explain. What do you mean by 'use'? Is PV_FONTDATADIR an 
> > environment variable? Or something CMake will patch in the source?
> > 
> > Kay
> >   
> 
> Compilation is called as
>       clang++ ... -DPV_FONTDATADIR="/usr/local/share/lux/fonts" ...
> so that in the source you can use
>       #if defined(PV_FONTDATADIR)
>               ... do something
>       #endif
> 
>       Kornel

An alternative is the following
Create a template pv_config.h.cmake (attached)
add to CMakeLists.txt the commands to create pv_config.h (in the build dir)
        patch attached

use
        #include "pv_config.h"
where needed.

        Kornel

-- 
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
--- 
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/hugin-ptx/20210318113410.3ec493c6%40admin1-desktop.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7bf029f..cf91656 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -159,13 +159,15 @@ install(TARGETS ${_pv} DESTINATION bin)
 if(UNIX)
 	set(DataDir "${CMAKE_INSTALL_PREFIX}/share/${_pv}/")
 elseif(WIN32)
 	set(DataDir "${CMAKE_INSTALL_PREFIX}/Resources/")
 elseif(APPLE)
-	set(DataDir "${CMAKE_INSTALL_PREFIX}/${_pv}.app/Contents/Resources")
+	set(DataDir "${CMAKE_INSTALL_PREFIX}/${_pv}.app/Contents/Resources/")
 endif()
-add_definitions(" -DPV_FONTDATADIR=${DataDir}/fonts")
+#add_definitions(" -DPV_FONTDATADIR=\"${DataDir}fonts\"")
+set(PV_FONTDATADIR "${DataDir}fonts")
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pv_config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/pv_config.h" @ONLY)
 
 install(FILES Sansation_Regular.ttf Sansation_1.31_ReadMe.txt DESTINATION
  "${DataDir}/fonts")
 
 set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX})
#ifndef _PV_CONFIG_H
#define _PV_CONFIG_H

#define PV_FONTDATADIR "@PV_FONTDATADIR@"

#endif

Attachment: pgpG34kcJzLxq.pgp
Description: Digitale Signatur von OpenPGP

Reply via email to