Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added system installation configuration #124

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ enable_testing()
option(RC_ENABLE_TESTS "Build RapidCheck tests" OFF)
option(RC_ENABLE_EXAMPLES "Build RapidCheck examples" OFF)

set(cmake_config_files
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this variable needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I follow the "write-once" principle in programming. I'm going to add a version file as soon as you respond to #123 (if you say yes). If not I'll remove it as it's unnecessary. In short it's a container for the loop below.

"rapidcheck-config.cmake"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming here is a CMake convention, I suppose?

Copy link
Author

@theNerd247 theNerd247 Jun 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the official docs, yes.

)

if(MSVC)
# /bigobj - some object files become very large so we need this
# /wd4503 - truncation of decorated name, not much we can do about it so
Expand Down Expand Up @@ -76,3 +80,34 @@ if (RC_ENABLE_EXAMPLES)
endif()

add_subdirectory(extras)

# install the targets and include directories
install(TARGETS rapidcheck
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
Copy link
Owner

@emil-e emil-e Jun 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation seems off, should be spaces and not tabs. In general, continuations should be aligned.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My apologies. I thought vim had the right syntax loaded...I'll fix the tabs. As far as your continuations: what mean you?

)

install(DIRECTORY "include/"
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the docs, relative paths are interpreted as being relative to CMAKE_INSTALL_PREFIX anyway so I would suggest simply specifying this as DESTINATION "include".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

)

# setup the cmake config files
# the include directories to export in our cmake config file
set(CONFIG_INCLUDE_DIRS
"${CMAKE_INSTALL_PREFIX}/include"
)

# The libraries to export in our cmake config file
set(CONFIG_LIBRARIES "rapidcheck")

# generate the cmake config files
foreach(f ${cmake_config_files})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said above, right now there is only one file.

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${f}.in"
"${PROJECT_BINARY_DIR}/${f}"
@ONLY
)

install(
FILES "${PROJECT_BINARY_DIR}/${f}"
DESTINATION "lib/cmake/rapidcheck"
)
endforeach()
6 changes: 5 additions & 1 deletion extras/boost/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ target_include_directories(rapidcheck_boost INTERFACE include)

if (RC_ENABLE_TESTS)
add_subdirectory(test)
endif()
endif()

install(DIRECTORY "include/"
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
)
4 changes: 4 additions & 0 deletions extras/boost_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
add_library(rapidcheck_boost_test INTERFACE)
target_link_libraries(rapidcheck_boost_test INTERFACE rapidcheck)
target_include_directories(rapidcheck_boost_test INTERFACE include)

install(DIRECTORY "include/"
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
)
6 changes: 5 additions & 1 deletion extras/catch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
add_library(rapidcheck_catch INTERFACE)
target_link_libraries(rapidcheck_catch INTERFACE rapidcheck)
target_include_directories(rapidcheck_catch INTERFACE include)
target_include_directories(rapidcheck_catch INTERFACE include)

install(DIRECTORY "include/"
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
)
6 changes: 5 additions & 1 deletion extras/gmock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ target_include_directories(rapidcheck_gmock INTERFACE include)

if (RC_ENABLE_TESTS)
add_subdirectory(test)
endif()
endif()

install(DIRECTORY "include/"
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
)
4 changes: 4 additions & 0 deletions extras/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
add_library(rapidcheck_gtest INTERFACE)
target_link_libraries(rapidcheck_gtest INTERFACE rapidcheck)
target_include_directories(rapidcheck_gtest INTERFACE include)

install(DIRECTORY "include/"
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
)
7 changes: 7 additions & 0 deletions rapidcheck-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#When run this file will define the following CMake cached variables:
#
# rapidcheck_INCLUDE_DIRS
# rapidcheck_LIBRARIES
#
set(rapidcheck_INCLUDE_DIRS "@CONFIG_INCLUDE_DIRS@")
set(rapidcheck_LIBRARIES "@CONFIG_LIBRARIES@")