[CMake] Feature request (with patch): add #cmakedefine-like directive without #define

dizzy dizzy at roedu.net
Wed Jan 23 07:21:17 EST 2008


On Wednesday 23 January 2008 14:11:06 Hendrik Sattler wrote:
> Quoting Pau Garcia i Quiles <pgquiles at elpauer.org>:
> > It would be nice if we had something like #cmakedefine but for
> > arbitrary files which only wrote the value. For example: "#cmakewrite
> > my_text", which would generate "my_text".
> >
> > Use case: combined use of configuration files and INSTALL directives.
> > I need to specify the application directory both in pfsi.conf and in
> > CMakeLists.txt for INSTALL( FILES ${PROJECT_SOURCE_DIR}/pfsi.png
> > DESTINATION ${CMAKE_INSTALL_PREFIX}/{PFSI_APP_DIR} ).
> >
> > For example, the configuration file pfsi.conf.cmake could then be:
> > --------------------
> > [global]
> >
> > #cmakewrite application_directory = ${PFSI_APP_DIR}
> >
> > [shared_folders]
> >
> > digest = /usr/wt/pfsi/htdigest-pfsi
> > shared_folders_directory = /media/tragabytes/webdav
> > ---------------------
>
> You mean something like
> [global]
> application_directory = @PFSI_APP_DIR@
>
> That's already possible.

To make things more clear (because I assume if he asked it he doesn't know how 
it works), cmake's CONFIGURE_FILE() will replace not only "#cmakedefine" but 
any variable placeholder of the form @VAR@ or ${VAR} (if the "@ONLY" option 
is not provided).

Just read the cmake manual page on CONFIGURE_FILE.

-- 
Mihai RUSU					Email: dizzy at roedu.net
			"Linux is obsolete" -- AST


More information about the CMake mailing list