Commit ae13ad80 authored by Davis King's avatar Davis King

Added more options for controlling the install folder paths.

parent d62c5a7c
...@@ -16,9 +16,17 @@ include_directories( ...@@ -16,9 +16,17 @@ include_directories(
#include(../../dlib/cmake) #include(../../dlib/cmake)
#set(additional_link_libraries dlib) #set(additional_link_libraries dlib)
# tell swig to put the output files into the local folder. # Tell swig to put the output files (the shared library and .jar) into the local folder.
set(install_target_output_folder .) set(install_target_output_folder .)
# Alternatively, instead of using install_target_output_folder, you can tell
# cmake to output the shared library, java source files, and the jar to
# separate output folders. These commands would put them into folders thelib,
# thesrc, and thejar, respectively.
#set(install_shared_library_output_folder thelib)
#set(install_java_source_output_folder thesrc)
#set(install_jar_output_folder thejar)
include(cmake_swig_jni) include(cmake_swig_jni)
......
...@@ -16,11 +16,18 @@ ...@@ -16,11 +16,18 @@
# include(../../dlib/dlib/cmake) # include(../../dlib/dlib/cmake)
# set(additional_link_libraries dlib) # set(additional_link_libraries dlib)
# #
# ### tell swig to put the output files into the parent folder of your CMakeLists.txt # ### Tell swig to put the output files into the parent folder of your CMakeLists.txt
# ### file when you run make install. # ### file when you run make install.
# set(install_target_output_folder ..) # set(install_target_output_folder ..)
# include(cmake_swig_jni) # include(cmake_swig_jni)
#
# ### Alternatively, instead of using install_target_output_folder, you can tell
# ### cmake to output the shared library, java source files, and the jar to
# ### separate output folders. These commands would put them into folders
# ### thelib, thesrc, and thejar, respectively.
# # set(install_shared_library_output_folder thelib)
# # set(install_java_source_output_folder thesrc)
# # set(install_jar_output_folder thejar)
...@@ -197,14 +204,15 @@ add_custom_command(TARGET ${output_library_name} ...@@ -197,14 +204,15 @@ add_custom_command(TARGET ${output_library_name}
) )
# Determine the path to our CMakeLists.txt file.
# There is either a bug (or break in compatability maybe) between versions
# of cmake that cause the or expression in this regular expression to be
# necessary.
string(REGEX REPLACE "(cmake_swig_jni|CMakeLists.txt)$" "" base_path ${CMAKE_PARENT_LIST_FILE})
#if the including cmake script set the install_target_output_folder variable #if the including cmake script set the install_target_output_folder variable
#then make it so we install the compiled library and jar into that folder #then make it so we install the compiled library and jar into that folder
if (install_target_output_folder) if (install_target_output_folder)
# Determine the path to our CMakeLists.txt file.
# There is either a bug (or break in compatability maybe) between versions
# of cmake that cause the or expression in this regular expression to be
# necessary.
string(REGEX REPLACE "(cmake_swig_jni|CMakeLists.txt)$" "" base_path ${CMAKE_PARENT_LIST_FILE})
# The directory we will write the output files to. # The directory we will write the output files to.
set(install_dir "${base_path}${install_target_output_folder}") set(install_dir "${base_path}${install_target_output_folder}")
set(CMAKE_INSTALL_PREFIX "${install_dir}") set(CMAKE_INSTALL_PREFIX "${install_dir}")
...@@ -217,6 +225,28 @@ if (install_target_output_folder) ...@@ -217,6 +225,28 @@ if (install_target_output_folder)
) )
endif() endif()
if (install_shared_library_output_folder)
set(install_dir "${base_path}${install_shared_library_output_folder}")
install(TARGETS ${output_library_name}
DESTINATION "${install_dir}"
)
endif()
if (install_java_source_output_folder)
set(install_dir "${base_path}${install_java_source_output_folder}")
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib/java_src/${package_root_name}
DESTINATION "${install_dir}"
)
endif()
if (install_jar_output_folder)
set(install_dir "${base_path}${install_jar_output_folder}")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib/${PROJECT_NAME}.jar
DESTINATION "${install_dir}"
)
endif()
# Copy any system libraries to the output folder. This really only matters on # Copy any system libraries to the output folder. This really only matters on
# windows where it's good to have the visual studio runtime show up in the lib # windows where it's good to have the visual studio runtime show up in the lib
# folder so that you don't forget to include it in your binary distribution. # folder so that you don't forget to include it in your binary distribution.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment