FreeCAD build, need cmake help

Richard Shaw hobbes1069 at gmail.com
Mon Nov 28 20:27:52 CET 2011


I did some searching and found an old thread about building FreeCAD
0.7 for Fedora 10 with autotools.

The good news is that FreeCAD now has a cmake option as well. The bad
news is that they didn't think it through very well for system wide
installs, meaning, it doesn't handle them period. It expect everything
to be installed under $HOME and be a stand alone app.

They are receptive to improvements for fixing the cmake build[1] as
they currently use a hackish script to make the build work system wide
for Debian. Though I'm not sure my cmake skills are up to the task.

In order to not change expectations for current builders I added a
cmake option FREECAD_PORTABLE_INSTALL and defaulted it to ON.

I've started hashing out the logic to set all the required paths
correctly using the names from the rpm %cmake macro. I think I can
make it work but this is where some best practices examples would be
really helpful.

I don't want to post the whole CMakeLists.txt file but here's the
chunk I added so far:

OPTION(FREECAD_PORTABLE_INSTALL "Build for use as a portable install
(Default)." ON)

# ============================================================
# == Check for and set required definitions for system wide install ==
# ============================================================
IF(UNIX AND NOT FREECAD_PORTABLE_INSTALL)
    MESSAGE(STATUS "Setting up system wide install.")
    # Make sure install prefix is set.
    IF(NOT CMAKE_INSTALL_PREFIX)
        MESSAGE(FATAL_ERROR "For system installs CMAKE_INSTALL_PREFIX
must be specified.")
    ENDIF(NOT CMAKE_INSTALL_PREFIX)
    # Set library install dir if not already specified.
    SET(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
    IF(NOT LIB_INSTALL_DIR)
        SET(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
    ENDIF(NOT LIB_INSTALL_DIR)
    MESSAGE(STATUS "  LIB_INSTALL_DIR: ${LIB_INSTALL_DIR}")
    # Set data dir if not already specified.
    IF(SHARE_INSTALL_PREFIX AND NOT SHARE_INSTALL_DIR)
        SET(SHARE_INSTALL_DIR ${SHARE_INSTALL_PREFIX}/freecad)
    ELSEIF(NOT SHARE_INSTALL_PREFIX AND NOT SHARE_INSTALL_DIR)
        SET(SHARE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/freecad)
    ENDIF(SHARE_INSTALL_PREFIX AND NOT SHARE_INSTALL_DIR)
    MESSAGE(STATUS "  SHARE_INSTALL_DIR: ${SHARE_INSTALL_DIR}")
    # Set include directory if not already specified.
    IF(NOT INCLUDE_INSTALL_DIR)
        SET(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/freecad)
    ENDIF(NOT INCLUDE_INSTALL_DIR)
    MESSAGE(STATUS "  INCLUDE_INSTALL_DIR: ${INCLUDE_INSTALL_DIR}")
ELSEIF(NOT UNIX AND NOT FREECAD_PORTABLE_INSTALL)
    MESSAGE(FATAL_ERROR "System wide installs are currently only
supported on *nix based systems.")
ELSE(UNIX AND NOT FREECAD_PORTABLE_INSTALL)
    MESSAGE(STATUS "Installation will be portable.")
ENDIF(UNIX AND NOT FREECAD_PORTABLE_INSTALL)
--- EOF ---

Suggestions before I get to far down this road?

Thanks,
Richard

[1] http://tinyurl.com/bos58oc (forum thread)


More information about the rpmfusion-developers mailing list