c++ - Converting old makefile to CMake -
i'm trying convert old makefile code cmake. can me? part i'm stuck. don't know how pass these arguments compiler.
compile_flags = -c -m32 -o3 -fpic -w -dsomething -wall -i src/sdk/core ifdef static outfile = "bin/test_static.so" compile_flags_2 = ./lib/abc.a else outfile = "bin/test.so" compile_flags_2 = -l/usr/lib/mysql -labc endif all: g++ $(compile_flags) src/sdk/*.cpp g++ $(compile_flags) src/*.cpp g++ -fshort-wchar -shared -o $(outfile) *.o $(compile_flags_2) rm -f *.o thank you!
let's try map makefile syntax cmake:
compile_flags = -c -m32 -o3 -fpic -w -dsomething -wall -i src/sdk/core this statement directly maps to:
set( compile_flags "-c -m32 -o3 -fpic -w -dsomething -wall" ) include_directories( src/sdk/core ) a conditional of type:
ifdef static # else # else endif is translated in cmake in way:
option(static "brief description" on) if( static ) # else() # else endif() to modify default compilation flags can set variables cmake_<lang>_flags_release, cmake_<lang>_flags_debug, etc. , appropriately.
finally compilation of executable requires use add_executable command, explained in many cmake tutorials.
in case suggest refer online documentation further details, quite explanatory , complete.
Comments
Post a Comment