Migrate from Jam to CMake
Asked Answered
D

3

6

I understand Jam builds existing projects and CMake generates projects to build. But, given I'd rather be generating projects I could use in various IDE's rather than trying to integrate Jam into those IDE's, has anybody had any experience/success turning a Jamfile into a CMakeLists.txt file?

Disconnected answered 10/4, 2012 at 21:0 Comment(0)
D
0

So I eventually decided the best thing to do was to start a CMAKE project from scratch. Our Jam project was such a mess, I didn't want to carry over the cruft of our spaghetti build.

I found these resources to be most helpful

http://www.cmake.org/Wiki/CMake_Useful_Variables http://www.cmake.org/cmake/help/v2.8.10/cmake.html

Disconnected answered 20/2, 2013 at 18:37 Comment(0)
M
5

I used to use Jam for all my Linux projects since it was easier than regular makefiles. I then discovered CMake and have not gone back. It's about as easy to write CMakeLists.txt files as it is to write Jamfiles, and you get platform-specific IDE support for free, though IMO the IDE projects are not quite as clean as something generated by hand.

From what I have seen, very few people use Jam these days, despite its many strengths. It does claim to be able to build on various platforms, but at the same time, it does not seem to be enjoying active development any more, so I tend to distrust its multiplatform claims.

As far as I know, there is no tool for automatically converting a hierarchy of Jamfiles into a hierarchy of CMakeLists.txt files, though such a tool would certainly be a feasible project. However, thanks to the unpopularity of Jam and to a lesser extent, CMake, unless you or I find some free time, such a tool is not on the horizon. :(

If your project is not too complex, some simple search and replace operations should transform a Jamfile into a CMakeLists.txt file. If your project is complex, then converting them by hand is probably your best bet.

Some simple transformations:

  • HDRS += a.h b.h c.h ; becomes include_directories(a.h b.h c.h)
  • Main HelloWorld : main.cpp utils.cpp ; becomes add_executable(HelloWorld main.cpp utils.cpp utils.h)
  • Library helper : helper.cpp becomes add_library(helper STATIC helper.cpp helper.h)
  • SubDir foo ; becomes add_subdirectory(foo)
  • LinkLibraries HelloWorld : libhelper ; becomes target_link_libraries(HelloWorld helper)

The IDE projects that CMake generates do not automatically include related header files, hence I explicitly included important ones in the examples above. There is a nice example here, if you haven't seen it already.

Micah answered 15/4, 2012 at 18:7 Comment(0)
R
1

For Jam to CMake conversion, it might be useful to try extending vcproj2cmake to have a Jam parser implementation, too (the generator part for CMake syntax text streams is fairly capable now).

Rodomontade answered 20/7, 2012 at 18:50 Comment(0)
D
0

So I eventually decided the best thing to do was to start a CMAKE project from scratch. Our Jam project was such a mess, I didn't want to carry over the cruft of our spaghetti build.

I found these resources to be most helpful

http://www.cmake.org/Wiki/CMake_Useful_Variables http://www.cmake.org/cmake/help/v2.8.10/cmake.html

Disconnected answered 20/2, 2013 at 18:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.