CMake custom library path

Hi,
I have written one application which links with one of the library. I am using cmake and name of the library file is libvici.so.0.0.0. (From strongswan). I am building my application for a ramips based architecture target and the shared library libvici.so.0.0.0 is available in folder openwrt-19.07.3/staging_dir/target-mipsel_24kc_musl/root-ramips/usr/lib/ipsec.
When compile my application, linker is unable to find this library and fails with following error:
/home/aashish/XE33/openwrt-19.07.3/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/lib/gcc/mipsel-openwrt-linux-musl/7.5.0/../../../../mipsel-openwrt-linux-musl/bin/ld: cannot find -lvici
The linker command being generated is:
/home/aashish/XE33/openwrt-19.07.3/staging_dir/host/bin/cmake -E cmake_link_script CMakeFiles/ipsec-status.dir/link.txt --verbose=1
/home/aashish/XE33/openwrt-19.07.3/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/bin/mipsel-openwrt-linux-musl-gcc -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -iremap/home/aashish/XE33/openwrt-19.07.3/build_dir/target-mipsel_24kc_musl/ipsec-status-0.1:ipsec-status-0.1 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DNDEBUG -L/home/aashish/XE33/openwrt-19.07.3/staging_dir/target-mipsel_24kc_musl/usr/lib -L/home/aashish/XE33/openwrt-19.07.3/staging_dir/target-mipsel_24kc_musl/lib -L/home/aashish/XE33/openwrt-19.07.3/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/usr/lib -L/home/aashish/XE33/openwrt-19.07.3/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/lib -znow -zrelro CMakeFiles/ipsec-status.dir/main.c.o -o ipsec-status -lubox -lubus -luci -lvici
Now you can see that it is unable to find the library because the additional path /ipsec is not added in the -L options.
I tried to add find_library in CMakeLists.txt like following:
find_library(vici NAMES vici)
But it does not work and build fails because it is unable to find the library.

How do I add this directory in linker path when using cmake based build script?

One solution is to create a OpenWrt package around your cmake project.

Here is a minimal example:

Inside of an OpenWrt package, you can use CMAKE_OPTIONS += \ to define additional CMake flag.

CMAKE_OPTIONS += \
  -L../../path/to/library \
  -I../../path/to/include

etc, etc

Also, if you are using an OpenWrt package, be sure you add:

include $(INCLUDE_DIR)/cmake.mk

in your package