update build system

This commit is contained in:
张壹 2021-08-02 21:54:09 +08:00
parent 69a4b33b8f
commit 4733fe57ac
2 changed files with 6 additions and 5 deletions

View File

@ -2,15 +2,16 @@
cmd=${1}
package=liblbfgs
address=/opt
address=/opt/stow
targetdir=/usr/local
if [[ ${cmd} == "configure" && ! -d "build/" ]]; then
mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=${address}/stow/${package} -DCMAKE_BUILD_TYPE=Release
mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=${address}/${package} -DCMAKE_BUILD_TYPE=Release
elif [[ ${cmd} == "configure" ]]; then
cd build && rm -rf * && cmake .. -DCMAKE_INSTALL_PREFIX=${address}/stow/${package} -DCMAKE_BUILD_TYPE=Release
cd build && rm -rf * && cmake .. -DCMAKE_INSTALL_PREFIX=${address}/${package} -DCMAKE_BUILD_TYPE=Release
elif [[ ${cmd} == "build" ]]; then
cd build && make
elif [[ ${cmd} == "install" ]]; then
cd build && sudo make install
sudo stow --dir=${address}/stow --target=${address} ${package}
sudo stow --dir=${address} --target=${targetdir} ${package}
fi

View File

@ -50,7 +50,7 @@ macro(add_sample name file)
#
add_executable(${name} sample/${file})
# Windows
set_target_properties(${name} PROPERTIES INSTALL_RPATH "/opt/lib")
set_target_properties(${name} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
#
target_link_libraries(${name} PUBLIC lbfgs)
endmacro()