-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The initial version has two independent libraries.
- Loading branch information
shahab
committed
Mar 13, 2016
0 parents
commit 363fe0e
Showing
6 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<<bye()<<std::endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// Created by shah on 13/03/16. | ||
// | ||
|
||
#ifndef SALUTATION_BYE_H | ||
#define SALUTATION_BYE_H | ||
|
||
|
||
#include <string> | ||
#include <iostream> | ||
|
||
class Bye { | ||
public: | ||
std::string bye(); | ||
void Saybye(); | ||
}; | ||
|
||
|
||
#endif //SALUTATION_BYE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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} | ||
) | ||
############################################################ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<<hello()<<std::endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// Created by shah on 13/03/16. | ||
// | ||
|
||
#ifndef SALUTATION_HELLO_H | ||
#define SALUTATION_HELLO_H | ||
|
||
|
||
#include <string> | ||
#include <iostream> | ||
|
||
class Hello { | ||
public: | ||
std::string hello(); | ||
void Sayhello(); | ||
}; | ||
|
||
|
||
|
||
|
||
#endif //SALUTATION_HELLO_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 () |