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

Make test app and installation of headers optional #8

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
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
82 changes: 43 additions & 39 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.0.0)

project(dynalo)
project(dynalo LANGUAGES CXX)

#set(CMAKE_CXX_STANDARD 11 )
#set(CMAKE_CXX_STANDARD_REQUIRED ON )
Expand All @@ -18,44 +18,48 @@ elseif(WIN32)
target_link_libraries(${PROJECT_NAME} INTERFACE kernel32)
endif()

set (DYNALO_INSTALL_API OFF CACHE BOOL "Installs headers and CMake helpers")
if (DYNALO_INSTALL_API)
install(
DIRECTORY "include/${PROJECT_NAME}"
DESTINATION "include"
)

install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets)

install(
DIRECTORY "include/${PROJECT_NAME}"
DESTINATION "include"
)

install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets)

include (CMakePackageConfigHelpers)
set(CONFIG_PACKAGE_BUILD_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}")
set(CONFIG_PACKAGE_INSTALL_LOCATION "lib/cmake/${PROJECT_NAME}")
write_basic_package_version_file (
"${CONFIG_PACKAGE_BUILD_LOCATION}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION 1.0.3
COMPATIBILITY AnyNewerVersion
)
export(
EXPORT ${PROJECT_NAME}Targets
FILE "${CONFIG_PACKAGE_BUILD_LOCATION}/${PROJECT_NAME}Targets.cmake"
#NAMESPACE ${PROJECT_NAME}::
)
configure_file(
"cmake/Config.cmake"
"${CONFIG_PACKAGE_BUILD_LOCATION}/${PROJECT_NAME}Config.cmake"
@ONLY
)
install(
EXPORT "${PROJECT_NAME}Targets"
FILE "${PROJECT_NAME}Targets.cmake"
#NAMESPACE ${PROJECT_NAME}::
DESTINATION "${CONFIG_PACKAGE_INSTALL_LOCATION}"
)
install(
FILES
"${CONFIG_PACKAGE_BUILD_LOCATION}/${PROJECT_NAME}Config.cmake"
"${CONFIG_PACKAGE_BUILD_LOCATION}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION "${CONFIG_PACKAGE_INSTALL_LOCATION}"
)
include (CMakePackageConfigHelpers)
set(CONFIG_PACKAGE_BUILD_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}")
set(CONFIG_PACKAGE_INSTALL_LOCATION "lib/cmake/${PROJECT_NAME}")
write_basic_package_version_file (
"${CONFIG_PACKAGE_BUILD_LOCATION}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION 1.0.3
COMPATIBILITY AnyNewerVersion
)
export(
EXPORT ${PROJECT_NAME}Targets
FILE "${CONFIG_PACKAGE_BUILD_LOCATION}/${PROJECT_NAME}Targets.cmake"
#NAMESPACE ${PROJECT_NAME}::
)
configure_file(
"cmake/Config.cmake"
"${CONFIG_PACKAGE_BUILD_LOCATION}/${PROJECT_NAME}Config.cmake"
@ONLY
)
install(
EXPORT "${PROJECT_NAME}Targets"
FILE "${PROJECT_NAME}Targets.cmake"
#NAMESPACE ${PROJECT_NAME}::
DESTINATION "${CONFIG_PACKAGE_INSTALL_LOCATION}"
)
install(
FILES
"${CONFIG_PACKAGE_BUILD_LOCATION}/${PROJECT_NAME}Config.cmake"
"${CONFIG_PACKAGE_BUILD_LOCATION}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION "${CONFIG_PACKAGE_INSTALL_LOCATION}"
)
endif()

add_subdirectory(test)
set (DYNALO_BUILD_TEST OFF CACHE BOOL "Builds test application")
if (DYNALO_BUILD_TEST)
add_subdirectory(test)
endif()
2 changes: 1 addition & 1 deletion include/dynalo/detail/windows/dynalo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace dynalo { namespace detail
{

std::string last_error()
inline std::string last_error()
{
// https://msdn.microsoft.com/en-us/library/ms680582%28VS.85%29.aspx
LPVOID lpMsgBuf;
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.0.0)

project(dynalo-test)
project(dynalo-test LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 11 )
set(CMAKE_CXX_STANDARD_REQUIRED ON )
Expand Down