forked from cbernet/cmake-examples
-
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.
- Loading branch information
0 parents
commit 039ba2d
Showing
13 changed files
with
131 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 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
|
||
project(app_project) | ||
|
||
add_library(hello SHARED hello.cc) | ||
|
||
add_executable(myapp main.cc) | ||
target_link_libraries(myapp hello) | ||
|
||
set(CMAKE_INSTALL_PREFIX _install) | ||
install(TARGETS hello DESTINATION lib) | ||
install(FILES hello.h DESTINATION include) | ||
install(TARGETS myapp DESTINATION bin) |
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,7 @@ | ||
#include "hello.h" | ||
|
||
#include <iostream> | ||
|
||
void hello() { | ||
std::cout<<"hello world!"<<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,3 @@ | ||
#include <iostream> | ||
|
||
void hello(); |
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,22 @@ | ||
// A simple program that computes the square root of a number | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <math.h> | ||
|
||
#include "hello.h" | ||
|
||
int main (int argc, char *argv[]) | ||
{ | ||
if (argc < 2) | ||
{ | ||
fprintf(stdout,"Usage: %s number\n",argv[0]); | ||
return 1; | ||
} | ||
double inputValue = atof(argv[1]); | ||
double outputValue = sqrt(inputValue); | ||
fprintf(stdout,"The square root of %g is %g\n", | ||
inputValue, outputValue); | ||
|
||
hello(); | ||
return 0; | ||
} |
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,7 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
|
||
project(app_project) | ||
|
||
add_executable(myapp main.cc) | ||
set(CMAKE_INSTALL_PREFIX _install) | ||
install(TARGETS myapp DESTINATION bin) |
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,3 @@ | ||
#include <iostream> | ||
|
||
void hello(); |
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,22 @@ | ||
// A simple program that computes the square root of a number | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <math.h> | ||
|
||
// #include "hello.h" | ||
|
||
int main (int argc, char *argv[]) | ||
{ | ||
if (argc < 2) | ||
{ | ||
fprintf(stdout,"Usage: %s number\n",argv[0]); | ||
return 1; | ||
} | ||
double inputValue = atof(argv[1]); | ||
double outputValue = sqrt(inputValue); | ||
fprintf(stdout,"The square root of %g is %g\n", | ||
inputValue, outputValue); | ||
|
||
// hello(); | ||
return 0; | ||
} |
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,14 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
|
||
project(hello) | ||
|
||
set(hello_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
|
||
include_directories(${hello_INCLUDE_DIR}) | ||
add_executable(test_hello main.cc) | ||
target_link_libraries(test_hello hello) | ||
|
||
set(CMAKE_INSTALL_PREFIX _install) | ||
install(TARGETS test_hello DESTINATION bin) | ||
|
||
add_subdirectory(src) |
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,3 @@ | ||
#include <iostream> | ||
|
||
void hello(); |
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,22 @@ | ||
// A simple program that computes the square root of a number | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <math.h> | ||
|
||
#include "hello.h" | ||
|
||
int main (int argc, char *argv[]) | ||
{ | ||
if (argc < 2) | ||
{ | ||
fprintf(stdout,"Usage: %s number\n",argv[0]); | ||
return 1; | ||
} | ||
double inputValue = atof(argv[1]); | ||
double outputValue = sqrt(inputValue); | ||
fprintf(stdout,"The square root of %g is %g\n", | ||
inputValue, outputValue); | ||
|
||
hello(); | ||
return 0; | ||
} |
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,8 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
|
||
project(lib_hello) | ||
|
||
add_library(hello SHARED hello.cc) | ||
|
||
install(TARGETS hello DESTINATION lib) | ||
install(FILES ${hello_INCLUDE_DIR}/hello.h DESTINATION include) |
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,7 @@ | ||
#include "hello.h" | ||
|
||
#include <iostream> | ||
|
||
void hello() { | ||
std::cout<<"hello world!"<<std::endl; | ||
} |
Empty file.