[Ves] header directory required before install step

James Fremen james_fremen at yahoo.com
Wed Jun 26 18:17:48 EDT 2013


hi..

I have an existing project which has headers with paths of the form "<project>/header.h" i.e. "Eigen/Core". So there may be multiple headers in <project> referring to each other using these paths. I'm not sure how to set this up properly for a super build. 

The file is in the source directory sit in <project>/include/header.h . I think i want it to be available in <build dir>/include/<project>/header.h before the sources which depend on the headers are built and <install dir>/include/<project>/header.h for putting it into a framework.

The VES build seems to be using the process_dir macro to copy the headers to the install directory but the problem is that the headers of this project and other projects in the same build refer to each other using the <project>/header.h paths.

I suppose they could be copied to the <build dir>, but it might be better to soft-link them so that build errors are fixed in one place and there are no date issues. Maybe something like this:

===========================
top-level superbuild.cmake:
===========================
set(base "${CMAKE_BINARY_DIR}/CMakeExternals")
set(build_prefix ${base}/Build)

macro(crosscompile_project proj tag toolchain_file)
  ExternalProject_Add(...
      -DBUILD_PREFIX:PATH=${build_prefix}
  )

endmacro()

===========================
CMakeLists.txt for the project:
===========================
# to avoid problems with adding the link target multiple times. It seems simpler but maybe
# there is a better way?
cmake_policy(SET CMP0002 OLD)

macro(link_dirs SOURCE_DIR DEST_DIR)
  add_custom_target(link ALL)

  # TBD perhaps this should be PRE-BUILD or BUILD?
  add_custom_command(

    TARGET link
    COMMAND ln -fsh ${SOURCE_DIR} ${DEST_DIR}
    )
endmacro()

execute_process(COMMAND mkdir ${BUILD_PREFIX}/include)
set(projdirs project0 project1)

foreach(d ${projdirs}) 
    link_dirs(${CMAKE_CURRENT_SOURCE_DIR}/${d}/include ${BUILD_PREFIX}/include/${d})

endforeach(d) 


include_directories(${BUILD_PREFIX}/include)
add_dependencies(mainproject link) # the mainproject target is added elsewhere

Then, at install time, a VES-style makeFramework.sh is used to create the framework.

Can someone suggest a better way of doing this? I don't have a lot of experience with cmake yet and would like to keep things simple.

thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/ves/attachments/20130626/90b626c4/attachment-0001.html>


More information about the Ves mailing list