diff --git a/Bye/Bye.cpp b/Bye/Bye.cpp new file mode 100644 index 0000000..94ae184 --- /dev/null +++ b/Bye/Bye.cpp @@ -0,0 +1,13 @@ +// +// Created by shah on 13/03/16. +// + +#include "Bye.h" + +std::string Bye::bye() { + return "bye"; +} + +void Bye::Saybye() { + std::cout< +#include + +class Bye { +public: + std::string bye(); + void Saybye(); +}; + + +#endif //SALUTATION_BYE_H diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..8764941 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,84 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +##A template for a package containing multiple projects, in this case: Hello and Bye. +PROJECT(Words) +set(PROJECT_VERSION_MAJOR 1) +set(PROJECT_VERSION_MINOR 1) +############################################################ +## Versioning/installation information +set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}") +set(PROJECT_DIRNAME "${PROJECT_NAME}-${PROJECT_VERSION}") + +set(PROJECT_DIRNAME_lib "lib/${PROJECT_DIRNAME}") +set(PROJECT_DIRNAME_include "include/${PROJECT_DIRNAME}") + +############################################################ + +add_library(Hello SHARED Hello/Hello.cpp ) +add_library(Bye STATIC Bye/Bye.cpp ) + +##List of libraries in the project +set(PROJECT_LIBRARIES + Hello + Bye) + +##Installation target for Headers for the libraries. +install( + FILES + Hello/Hello.h + DESTINATION + ${PROJECT_DIRNAME_include}/Hello +) +install( + FILES + Bye/Bye.h + DESTINATION + ${PROJECT_DIRNAME_include}/Bye +) +##Installation target for the Libraries exported from this package. +install( + TARGETS + Bye + Hello + DESTINATION + ${PROJECT_DIRNAME_lib} + EXPORT + ${PROJECT_NAME}Exports +) + +install( + EXPORT + ${PROJECT_NAME}Exports + DESTINATION + ${PROJECT_DIRNAME_lib} +) + +############################################################ +##Config file configurations. PROJECT_DIRNAME_include will be made relocatable. + +include(CMakePackageConfigHelpers) +configure_package_config_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + INSTALL_DESTINATION + ${PROJECT_DIRNAME_lib} + PATH_VARS + PROJECT_DIRNAME_include +) + +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" + VERSION ${PROJECT_VERSION} + COMPATIBILITY AnyNewerVersion +) + +############################################################ +##Installation target for the COnfig files configured in the previous step. + +install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake + DESTINATION + ${PROJECT_DIRNAME_lib} +) +############################################################ diff --git a/Hello/Hello.cpp b/Hello/Hello.cpp new file mode 100644 index 0000000..3f6f299 --- /dev/null +++ b/Hello/Hello.cpp @@ -0,0 +1,13 @@ +// +// Created by shah on 13/03/16. +// + +#include "Hello.h" + +std::string Hello::hello() { + return "Hi"; +} + +void Hello::Sayhello() { + std::cout< +#include + +class Hello { + public: + std::string hello(); + void Sayhello(); +}; + + + + +#endif //SALUTATION_HELLO_H diff --git a/cmake/WordsConfig.cmake.in b/cmake/WordsConfig.cmake.in new file mode 100644 index 0000000..0e34b49 --- /dev/null +++ b/cmake/WordsConfig.cmake.in @@ -0,0 +1,29 @@ +@PACKAGE_INIT@ + +#Looks up the info about the exported targets in this package +IF(NOT TARGET @PROJECT_NAME@) +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Exports.cmake) +ENDIF() + +############################################################ + +##The public variables to be used by the client project: +#PROJECT_NAME_INCLUDE_DIRS is all the include paths +#PROJECT_NAME_LIBRARIES is the name of all the libraries +##ie the client package can use proj1_INCLUDE_DIRS and proj1_LIBRARIES + + +## PROJECT_LIBRARIES is filled-in during the package build +SET(@PROJECT_NAME@_LIBRARIES @PROJECT_LIBRARIES@) + +## PACKAGE_PROJECT_DIRNAME_include is filled-in during the package build +FOREACH(lib ${@PROJECT_NAME@_LIBRARIES}) +list(APPEND INCLUDE_DIRS @PACKAGE_PROJECT_DIRNAME_include@/${lib}) +ENDFOREACH(lib) + +#set_and_check() Makes sure that the created Config file does not contain +#wrong references. Then we add it to the public PROJECT_NAME_INCLUDE_DIRS +foreach (INCLUDE_DIR ${INCLUDE_DIRS}) +set_and_check(@PROJECT_NAME@_INCLUDE_DIR ${INCLUDE_DIR}) +list(APPEND @PROJECT_NAME@_INCLUDE_DIRS ${@PROJECT_NAME@_INCLUDE_DIR}) +endforeach ()