qt - Setting PATH/LD_LIBRARY_PATH for 'make check' with QMake -


i have project setup couple of apps shared library, built nicely using subdirs project, apps depend on shared library.

template = subdirs subdirs = app1 app2 sharedlib app1.depends = sharedlib app2.depends = sharedlib 

each app contains number of tests, config += testcase set.

this creates check target can run unit test top level .pro using make check.

the problem of app tests require presence of code within sharedlib, therefore needs discoverable according each platforms library lookup rules.

on windows 1 option have sharedlib location on path, on linux can add sharedlib location ld_library_path, on mac dyld_library_path.

one solution set location of built shared lib before running make check:

export ld_library_path=$ld_library_path:build/shareddll/ make check 

and works, seems little redundant build scripts building shared library know path sharedlib binary location, can referenced within .pro/pri files at:

$$top_builddir/sharedlib/release 

so, there anyway set path/ld_library_path/dyld_library_path within project files purposes of make check command?

if using gcc, can use rpath parameter of gcc.

-rpath=dir
      add directory runtime library search path. used
      when linking elf executable shared objects. -rpath
      arguments concatenated , passed runtime linker, which
      uses them locate shared objects @ runtime.

qmake_cxxflags += -rpath=/the/absolute/path

if use technique, not necessary edit ld_library_path


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -