implemented SOVERSION for shared libs

This commit is contained in:
Charlton, Scott R 2020-09-16 21:40:45 -07:00
parent 3091de68dd
commit dbba3f26dc
4 changed files with 35 additions and 50 deletions

View File

@ -1,9 +1,11 @@
# CMAKE_MSVC_RUNTIME_LIBRARY requires 3.15
cmake_minimum_required(VERSION 3.15)
project (IPhreeqc
project (
IPhreeqc
VERSION 3.6.3
LANGUAGES CXX C)
LANGUAGES CXX C
)
# check if this is the root project
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
@ -316,6 +318,11 @@ if (MSVC AND BUILD_SHARED_LIBS AND BUILD_CLR_LIBS)
target_compile_definitions(IPhreeqc PRIVATE "MULTICHART")
endif()
set_target_properties(IPhreeqc PROPERTIES
VERSION "${IPhreeqc_VERSION}"
SOVERSION "${IPhreeqc_VERSION_MAJOR}"
)
# install
if (STANDALONE_BUILD)

View File

@ -11,7 +11,7 @@ configure_file(ex2 ex2 COPYONLY)
# find IPhreeqc export package
# set CMAKE_PREFIX_PATH or IPhreeqc_DIR to the
# location of the IPhreeqcConfig.cmake file
find_package(IPhreeqc REQUIRED)
find_package(IPhreeqc 3 REQUIRED)
# add executable target
add_executable(example main.cpp)
@ -19,46 +19,3 @@ add_executable(example main.cpp)
# set link libraries as well as include paths
#target_link_libraries(example PUBLIC IPhreeqc::IPhreeqc)
target_link_libraries(example IPhreeqc::IPhreeqc)
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
get_property(inc_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
message("inc_dirs = ${inc_dirs}")
# get_target_property(target_inc_dirs IPhreeqc::IPhreeqc INCLUDE_DIRECTORIES)
# message("target_inc_dirs = ${target_inc_dirs}")
# get_target_property(imported_location IPhreeqc::IPhreeqc IMPORTED_LOCATION)
# message("imported_location = ${imported_location}")
# get_target_property(e_target_inc_dirs example INCLUDE_DIRECTORIES)
# message("e_target_inc_dirs = ${e_target_inc_dirs}")
# get_target_property(e_imported_location example IMPORTED_LOCATION)
# message("e_imported_location = ${e_imported_location}")
get_target_property(_var IPhreeqc::IPhreeqc INTERFACE_INCLUDE_DIRECTORIES)
message("IPhreeqc.INTERFACE_INCLUDE_DIRECTORIES = ${_var}")
get_target_property(_var IPhreeqc::IPhreeqc IMPORTED_LINK_INTERFACE_LANGUAGES)
message("IPhreeqc.IMPORTED_LINK_INTERFACE_LANGUAGES = ${_var}")
get_target_property(_var IPhreeqc::IPhreeqc IMPORTED_LOCATION_RELEASE)
message("IPhreeqc.IMPORTED_LOCATION_RELEASE = ${_var}")
get_target_property(_var IPhreeqc::IPhreeqc IMPORTED_LIBNAME)
message("IPhreeqc.IMPORTED_LIBNAME = ${_var}")
get_target_property(_var IPhreeqc::IPhreeqc IMPORTED_CONFIGURATIONS)
message("IPhreeqc.IMPORTED_CONFIGURATIONS = ${_var}")
get_target_property(_var IPhreeqc::IPhreeqc LINK_INTERFACE_LIBRARIES)
message("IPhreeqc.LINK_INTERFACE_LIBRARIES = ${_var}")
get_target_property(_var IPhreeqc::IPhreeqc IMPORTED_LINK_INTERFACE_LIBRARIES)
message("IPhreeqc.IMPORTED_LINK_INTERFACE_LIBRARIES = ${_var}")

View File

@ -1,19 +1,38 @@
Example usage
--------------------------------------------------------------------------------------
Windows
--------------------------------------------------------------------------------------
Configure, build and install IPhreeqc
1. cd iphreeqc-3.6.2-15100
2. mkdir _build
3. cd _build
4. cmake -DCMAKE_INSTALL_PREFIX:PATH=c:/Users/charlton/iphreeqc ..
5. cmake --build . --config release
6. ctest .
6. cmake --build . --config release --target install
7. cmake --build . --config release --target install
Build example:
1. cd c:\Users\charlton\iphreeqc\examples\using-cmake
2. mkdir _build
3. cmake -DCMAKE_PREFIX_PATH:PATH=c:/Users/charlton/iphreeqc/lib/cmake/IPhreeqc ..
4. cmake --build . --config release
--------------------------------------------------------------------------------------
Linux/macOS
--------------------------------------------------------------------------------------
Configure, build and install IPhreeqc
1. cd iphreeqc-3.6.2-15100
2. mkdir _build
3. cd _build
4. cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/charlton/iphreeqc ..
5. cmake --build .
6. ctest .
7. cmake --build . --target install
Build example:
1. cd /home/charlton/iphreeqc/share/doc/IPhreeqc/examples/using-cmake
2. mkdir _build
3. cd _build
4. cmake -DCMAKE_PREFIX_PATH:PATH=/home/charlton/iphreeqc ..
5. cmake --build .

View File

@ -9,10 +9,12 @@ int main (void)
std::cout << iphreeqc.GetErrorString();
return EXIT_FAILURE;
}
iphreeqc.SetOutputFileOn(true);
iphreeqc.SetOutputFileName("ex2.out");
if (iphreeqc.RunFile("ex2") != 0)
{
std::cout << iphreeqc.GetErrorString();
return EXIT_FAILURE;
}
return 0;
}
}