Skip to content

Commit

Permalink
Merge pull request #4 from lereldarion/master
Browse files Browse the repository at this point in the history
CMake: use GNUInstallDirs
  • Loading branch information
jydu authored Jun 8, 2017
2 parents a97cbea + 866eb52 commit c782f8d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ if (CMAKE_INSTALL_PREFIX)
set (CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}" ${CMAKE_PREFIX_PATH})
endif (CMAKE_INSTALL_PREFIX)

include (GNUInstallDirs)
find_package (bpp-seq 11.0.0 REQUIRED)

# CMake package
set (cmake-package-location lib/cmake/${PROJECT_NAME})
set (cmake-package-location ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
include (CMakePackageConfigHelpers)
configure_package_config_file (
package.cmake.in
Expand Down
9 changes: 3 additions & 6 deletions bpp-popgen.spec
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ building applications which use %{_basename}.
%build
CFLAGS="$RPM_OPT_FLAGS"
CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=%{_prefix} -DBUILD_TESTING=OFF"
if [ %{_lib} == 'lib64' ] ; then
CMAKE_FLAGS="$CMAKE_FLAGS -DLIB_SUFFIX=64"
fi
cmake $CMAKE_FLAGS .
make

Expand All @@ -82,11 +79,11 @@ rm -rf $RPM_BUILD_ROOT
%files -n libbpp-popgen-devel
%defattr(-,root,root)
%doc AUTHORS.txt COPYING.txt INSTALL.txt ChangeLog
%dir %{_prefix}/lib/cmake/
%dir %{_prefix}/lib/cmake/bpp-popgen
%dir %{_prefix}/%{_lib}/cmake/
%dir %{_prefix}/%{_lib}/cmake/bpp-popgen
%{_prefix}/%{_lib}/lib*.so
%{_prefix}/%{_lib}/lib*.a
%{_prefix}/lib/cmake/bpp-popgen/bpp-popgen*.cmake
%{_prefix}/%{_lib}/cmake/bpp-popgen/bpp-popgen*.cmake
%{_prefix}/include/*

%changelog
Expand Down
11 changes: 6 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ set (CPP_FILES
add_library (${PROJECT_NAME}-static STATIC ${CPP_FILES})
target_include_directories (${PROJECT_NAME}-static PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>
)
set_target_properties (${PROJECT_NAME}-static PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
target_link_libraries (${PROJECT_NAME}-static ${BPP_LIBS_STATIC})
Expand All @@ -52,7 +52,7 @@ target_link_libraries (${PROJECT_NAME}-static ${BPP_LIBS_STATIC})
add_library (${PROJECT_NAME}-shared SHARED ${CPP_FILES})
target_include_directories (${PROJECT_NAME}-shared PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>
)
set_target_properties (${PROJECT_NAME}-shared
PROPERTIES OUTPUT_NAME ${PROJECT_NAME}
Expand All @@ -66,12 +66,13 @@ target_link_libraries (${PROJECT_NAME}-shared ${BPP_LIBS_SHARED})
install (
TARGETS ${PROJECT_NAME}-static ${PROJECT_NAME}-shared
EXPORT ${PROJECT_NAME}-targets
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install (
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bpp
DESTINATION include
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
)
# Install cmake file representing targets
Expand Down

0 comments on commit c782f8d

Please sign in to comment.