[CMake] relative pathnames in projectfiles, and icon resources?

William A. Hoffman billlist at nycap.rr.com
Sun Aug 27 22:18:47 EDT 2006


At 09:46 PM 8/27/2006, erwin at erwincoumans.com wrote:
>I am (trying to) migrate from jam+msvcgen to cmake for projectfile autogeneration. Previously, I ran jam msvcgen to autogenerate all projectfiles, and then those *.vcproj,*.sln,*.dsw,*.dsp got distributed. So developers could use the distributed projectfiles out-of-the-box.
>It included resource files, with icon. 
>1) Can you configure cmake to include an icon?

This is possible with cmake.   Look at the CMake sources. 
In MFCDialot there is an icon referenced in the CMakeSetup.rc file.
You just add CMakeSetup.rc to the source list of the target.
You will also want this:

# Use of CMAKE_MFC_FLAG
# Values:
# 0: Use Standard Windows Libraries
# 1: Use MFC in a Static Library
# 2: Use MFC in a Shared DLL
SET(CMAKE_MFC_FLAG 2)
>2) can Cmake create redistributable projectfiles, with just relative paths? 
>I am very new to cmake, and I just used some example that uses absolete paths in the generated projectfiles. I won't be able to distribute/package those.
>                                RelativePath="C:\develop\bulletsourceforge\Bullet\BroadphaseCollision\Ax 

This is not possible with cmake.  The projects depend on cmake being installed.
Also, cmake can do system introspection, so it is not a good idea to move the generated makefiles
from system to system.   You can try setting the cmake variable CMAKE_USE_RELATIVE_PATHS and CMAKE_SUPPRESS_REGENERATION to true.   However this is not well tested or recommend.


-Bill





More information about the CMake mailing list