Alternate build directory for CMake-based port?

Kevin Reid kpreid at switchb.org
Thu Aug 23 07:39:43 PDT 2012


I am interested in getting the GNU Radio ports (gnuradio-*) updated to the latest version. (Relevant ticket: <https://trac.macports.org/ticket/31475>. The maintainer has acknowledged the problem but no work has been done for 11 months.) I have not seriously attempted to work on portfiles before.

GNU Radio 3.6.* has switched exclusively to a CMake-based build system. For the most part, I have been able to simply apply the cmake PortGroup and modify the configuration parameters to CMake style.

However, GNU Radio also insists that the build directory be different from the source directory; the CMakeLists.txt file contains:

if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
    message(FATAL_ERROR "Prevented in-tree build. This is bad practice.")
endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})

I could of course patch out this condition, but that seems unnecessarily fragile if it even works. How can I tell MacPorts to use distinct source and build directories for a CMake-based port?

The official build instructions are to do
  (in gnuradio source)
  mkdir build
  cd build
  cmake ../
  make
but since MacPorts takes care of these commands via its own infrastructure I don't know where to "just" insert a cd command and tweak the pathnames.

-- 
Kevin Reid                                  <http://switchb.org/kpreid/>



More information about the macports-dev mailing list