i have c++ project developed using xcode on mac , set same project using cmake. project makes use of external libraries, including eigen , boost. xcode has rather long list of build settings, including paths external libraries, specification of compiler version, additional linker flags, compiler optimization level, etc... , wondering of information goes in cmakelists.txt file. i've searched extensively on have found precious little. new cmake , have never written make files before. if there utility convert xcode project cmake project, ideal. glad know of tutorial on this, or have specific guidance. on appreciated.
conversion strategy
i pretty sure easiest , fastest way move cmake mixture of looking @ comparable projects link same dependencies, , maybe copying few relative file paths source files xcode. well-written cmakelists.txt uses eigen , boost can small (and platform-independent).
one reason cmake has different way use dependencies. well-known libraries such boost, cmake includes scripts include headers , link libraries.
minimal cmakelists.txt
a minimal example may this:
find_package(eigen3 required) find_package(boost required components system) add_executable( app src/main.cpp ) target_include_directories( app ${eigen3_include_dirs} ${boost_include_dir} ) target_link_libraries( app ${boost_libraries} )
example projects
for eigen, there no such pre-installed script can called find_package. here 2 real-world example projects link eigen , boost: https://github.com/ompl/ompl/blob/master/cmakelists.txt https://github.com/roboticslibrary/rl
here example find script eigen.
as piece of advice, cmake projects out there convoluted , use old syntax, newer project files tend use small letters in commands.
Comments
Post a Comment