mirror of
https://github.com/ttroy50/cmake-examples.git
synced 2025-12-18 20:24:35 +03:00
Update from inc to include directory
This commit is contained in:
@@ -19,5 +19,5 @@ add_executable(hello_headers ${SOURCES})
|
|||||||
# Set the direcoties that should be included in the build command for this target
|
# Set the direcoties that should be included in the build command for this target
|
||||||
# when running g++ these will be included as -I/directory/path/
|
# when running g++ these will be included as -I/directory/path/
|
||||||
target_include_directories(hello_headers
|
target_include_directories(hello_headers
|
||||||
PRIVATE ${PROJECT_SOURCE_DIR}/inc
|
PRIVATE ${PROJECT_SOURCE_DIR}/include
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ The files in this tutorial include:
|
|||||||
B-hello-headers$ tree
|
B-hello-headers$ tree
|
||||||
.
|
.
|
||||||
├── CMakeLists.txt
|
├── CMakeLists.txt
|
||||||
├── inc
|
├── include
|
||||||
│ └── Hello.h
|
│ └── Hello.h
|
||||||
└── src
|
└── src
|
||||||
├── Hello.cpp
|
├── Hello.cpp
|
||||||
@@ -24,7 +24,7 @@ B-hello-headers$ tree
|
|||||||
```
|
```
|
||||||
|
|
||||||
* link:CMakeLists.txt[CMakeLists.txt] - Contains the CMake commands you wish to run.
|
* link:CMakeLists.txt[CMakeLists.txt] - Contains the CMake commands you wish to run.
|
||||||
* link:inc/Hello.h[inc/Hello.h] - The header file to include.
|
* link:include/Hello.h[include/Hello.h] - The header file to include.
|
||||||
* link:src/Hello.cpp[src/Hello.cpp] - A source file to compile.
|
* link:src/Hello.cpp[src/Hello.cpp] - A source file to compile.
|
||||||
* link:src/main.cpp[src/main.cpp] - The source file with main.
|
* link:src/main.cpp[src/main.cpp] - The source file with main.
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ When you have different include folders, you can make your compiler aware of the
|
|||||||
[source,cmake]
|
[source,cmake]
|
||||||
----
|
----
|
||||||
target_include_directories(target
|
target_include_directories(target
|
||||||
PRIVATE ${PROJECT_SOURCE_DIR}/inc
|
PRIVATE ${PROJECT_SOURCE_DIR}/include
|
||||||
)
|
)
|
||||||
----
|
----
|
||||||
|
|
||||||
@@ -162,10 +162,10 @@ make -f CMakeFiles/hello_headers.dir/build.make CMakeFiles/hello_headers.dir/bui
|
|||||||
make[2]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/hello_headers/build'
|
make[2]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/hello_headers/build'
|
||||||
/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/01-basic/hello_headers/build/CMakeFiles 1
|
/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/01-basic/hello_headers/build/CMakeFiles 1
|
||||||
[ 50%] Building CXX object CMakeFiles/hello_headers.dir/src/Hello.cpp.o
|
[ 50%] Building CXX object CMakeFiles/hello_headers.dir/src/Hello.cpp.o
|
||||||
/usr/bin/c++ -I/home/matrim/workspace/cmake-examples/01-basic/hello_headers/inc -o CMakeFiles/hello_headers.dir/src/Hello.cpp.o -c /home/matrim/workspace/cmake-examples/01-basic/hello_headers/src/Hello.cpp
|
/usr/bin/c++ -I/home/matrim/workspace/cmake-examples/01-basic/hello_headers/include -o CMakeFiles/hello_headers.dir/src/Hello.cpp.o -c /home/matrim/workspace/cmake-examples/01-basic/hello_headers/src/Hello.cpp
|
||||||
/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/01-basic/hello_headers/build/CMakeFiles 2
|
/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/01-basic/hello_headers/build/CMakeFiles 2
|
||||||
[100%] Building CXX object CMakeFiles/hello_headers.dir/src/main.cpp.o
|
[100%] Building CXX object CMakeFiles/hello_headers.dir/src/main.cpp.o
|
||||||
/usr/bin/c++ -I/home/matrim/workspace/cmake-examples/01-basic/hello_headers/inc -o CMakeFiles/hello_headers.dir/src/main.cpp.o -c /home/matrim/workspace/cmake-examples/01-basic/hello_headers/src/main.cpp
|
/usr/bin/c++ -I/home/matrim/workspace/cmake-examples/01-basic/hello_headers/include -o CMakeFiles/hello_headers.dir/src/main.cpp.o -c /home/matrim/workspace/cmake-examples/01-basic/hello_headers/src/main.cpp
|
||||||
Linking CXX executable hello_headers
|
Linking CXX executable hello_headers
|
||||||
/usr/bin/cmake -E cmake_link_script CMakeFiles/hello_headers.dir/link.txt --verbose=1
|
/usr/bin/cmake -E cmake_link_script CMakeFiles/hello_headers.dir/link.txt --verbose=1
|
||||||
/usr/bin/c++ CMakeFiles/hello_headers.dir/src/Hello.cpp.o CMakeFiles/hello_headers.dir/src/main.cpp.o -o hello_headers -rdynamic
|
/usr/bin/c++ CMakeFiles/hello_headers.dir/src/Hello.cpp.o CMakeFiles/hello_headers.dir/src/main.cpp.o -o hello_headers -rdynamic
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ set(library_SOURCES
|
|||||||
add_library(hello_library STATIC ${library_SOURCES})
|
add_library(hello_library STATIC ${library_SOURCES})
|
||||||
|
|
||||||
target_include_directories(hello_library
|
target_include_directories(hello_library
|
||||||
PUBLIC ${PROJECT_SOURCE_DIR}/inc
|
PUBLIC ${PROJECT_SOURCE_DIR}/include
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ The files in this tutorial are below:
|
|||||||
$ tree
|
$ tree
|
||||||
.
|
.
|
||||||
├── CMakeLists.txt
|
├── CMakeLists.txt
|
||||||
├── inc
|
├── include
|
||||||
│ └── Hello.h
|
│ └── Hello.h
|
||||||
└── src
|
└── src
|
||||||
├── Hello.cpp
|
├── Hello.cpp
|
||||||
@@ -22,7 +22,7 @@ $ tree
|
|||||||
```
|
```
|
||||||
|
|
||||||
* link:CMakeLists.txt[] - Contains the CMake commands you wish to run
|
* link:CMakeLists.txt[] - Contains the CMake commands you wish to run
|
||||||
* link:inc/Hello.h[] - The header file to include
|
* link:include/Hello.h[] - The header file to include
|
||||||
* link:src/Hello.cpp[] - A source file to compile
|
* link:src/Hello.cpp[] - A source file to compile
|
||||||
* link:src/main.cpp[] - The source file with main
|
* link:src/main.cpp[] - The source file with main
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ In this example, we include directories in the library using the +target_include
|
|||||||
[source,cmake]
|
[source,cmake]
|
||||||
----
|
----
|
||||||
target_include_directories(hello_library
|
target_include_directories(hello_library
|
||||||
PUBLIC ${PROJECT_SOURCE_DIR}/inc
|
PUBLIC ${PROJECT_SOURCE_DIR}/include
|
||||||
)
|
)
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ add_library(hello_library SHARED ${library_SOURCES})
|
|||||||
add_library(hello::library ALIAS hello_library)
|
add_library(hello::library ALIAS hello_library)
|
||||||
|
|
||||||
target_include_directories(hello_library
|
target_include_directories(hello_library
|
||||||
PUBLIC ${PROJECT_SOURCE_DIR}/inc
|
PUBLIC ${PROJECT_SOURCE_DIR}/include
|
||||||
)
|
)
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
@@ -34,4 +34,4 @@ add_executable(hello_binary ${binary_SOURCES})
|
|||||||
# link the new hello_library target with the hello_binary target
|
# link the new hello_library target with the hello_binary target
|
||||||
target_link_libraries( hello_binary
|
target_link_libraries( hello_binary
|
||||||
PRIVATE hello::library
|
PRIVATE hello::library
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ The files in this tutorial are below:
|
|||||||
$ tree
|
$ tree
|
||||||
.
|
.
|
||||||
├── CMakeLists.txt
|
├── CMakeLists.txt
|
||||||
├── inc
|
├── include
|
||||||
│ └── Hello.h
|
│ └── Hello.h
|
||||||
└── src
|
└── src
|
||||||
├── Hello.cpp
|
├── Hello.cpp
|
||||||
@@ -24,7 +24,7 @@ $ tree
|
|||||||
```
|
```
|
||||||
|
|
||||||
* link:CMakeLists.txt[] - Contains the CMake commands you wish to run
|
* link:CMakeLists.txt[] - Contains the CMake commands you wish to run
|
||||||
* link:inc/Hello.h[] - The header file to include
|
* link:include/Hello.h[] - The header file to include
|
||||||
* link:src/Hello.cpp[] - A source file to compile
|
* link:src/Hello.cpp[] - A source file to compile
|
||||||
* link:src/main.cpp[] - The source file with main
|
* link:src/main.cpp[] - The source file with main
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ add_library(cmake_examples_inst SHARED ${library_SOURCES})
|
|||||||
|
|
||||||
|
|
||||||
target_include_directories(cmake_examples_inst
|
target_include_directories(cmake_examples_inst
|
||||||
PUBLIC ${PROJECT_SOURCE_DIR}/inc
|
PUBLIC ${PROJECT_SOURCE_DIR}/include
|
||||||
)
|
)
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ $ tree
|
|||||||
.
|
.
|
||||||
├── cmake-examples.conf
|
├── cmake-examples.conf
|
||||||
├── CMakeLists.txt
|
├── CMakeLists.txt
|
||||||
├── inc
|
├── include
|
||||||
│ └── Hello.h
|
│ └── Hello.h
|
||||||
├── README.adoc
|
├── README.adoc
|
||||||
└── src
|
└── src
|
||||||
@@ -26,7 +26,7 @@ $ tree
|
|||||||
|
|
||||||
* link:CMakeLists.txt[] - Contains the CMake commands you wish to run
|
* link:CMakeLists.txt[] - Contains the CMake commands you wish to run
|
||||||
* link:cmake-examples.conf[] - An example configuration file
|
* link:cmake-examples.conf[] - An example configuration file
|
||||||
* link:inc/Hello.h[] - The header file to include
|
* link:include/Hello.h[] - The header file to include
|
||||||
* link:src/Hello.cpp[] - A source file to compile
|
* link:src/Hello.cpp[] - A source file to compile
|
||||||
* link:src/main.cpp[] - The source file with main
|
* link:src/main.cpp[] - The source file with main
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user