c++ - CMAKE create OSX bundle for dylib? -



c++ - CMAKE create OSX bundle for dylib? -

i need help from unlike me knows cmake.

problem: have cmake project produces .so/.dylib/.dll (its plugin application) , far fine it's compiling , linking , produces expected output. it's setup build module this:

add_library(${project_name} module ${core_src} ${core_headers})

with healthy bunch of external dependencies , few compiler/linker settings.

and builds using 2 custom targets:

add_custom_target(debug command ${cmake_command} -dcmake_build_type=debug ${cmake_source_dir} command ${cmake_command} --build ${cmake_binary_dir} --target comment "switch cmake_build_type debug") add_custom_target(release command ${cmake_command} -dcmake_build_type=release ${cmake_source_dir} command ${cmake_command} --build ${cmake_binary_dir} --target comment "switch cmake_build_type release")

my problem on osx dylib must packaged osx bundle or wont load. create bundle directory construction manually not comprehensive cmake knowledge believe should able have generated me. did seek follow examples, work executable files.

what have dylib installed bundle resources within out of source directory. on other platforms resources go folder next dylib. , have bundle installed, or dll , folder, whatever destination destined for.

so how bundle module? possible or wasting time?

this quite possible cmake; tho remember having hard time figuring out well.

i have rather complex project thing dylib, framework, , series of plugins (which happen .sos). here 1 of cmakelists.txt files covers of need (around line 38).

if want cmake crate bundle you, need pass macosx_bundle when add together executable (add_executable). note application , not dylib.

if possible build dylib framework (framework property), cmake should automatically set it bundle's frameworks directory when add together it. dito plugins if build them bundle property.

you can manually assign macosx_package_location property whatever like

i believe may have set(cmake_install_rpath @loader_path/../frameworks) on target.

let me know if have questions , update answer.

c++ osx cmake

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -