Discussion:
[lttng-ust GIT PULL] Doc: add a CMake example
(too old to reply)
Sebastien Boisvert
2016-06-17 04:09:07 UTC
Permalink
Hi Mathieu,

Please pull 7 commits for a new example in the documentation:


The following changes since commit 01f0e40ce5b0c30c7c0706b63532049b311c83cf
are available in the git repository at

https://github.com/sebhtml/lttng-ust.git tags/cmake-multiple-shared-libraries.2016-06-17


Sebastien Boisvert (7):
Doc: add CMake example
Doc: clean up cmake example
Doc: add a trace.sh script in the cmake example
Doc: clean up cmake file
Doc: fix English issue
Doc: rename cmake example
Doc: ship cmake example with 'make distcheck'



doc/examples/Makefile.am | 15 +++++++++++++
doc/examples/cmake-multiple-shared-libraries/CMakeLists.txt | 20 +++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/README.md | 52 +++++++++++++++++++++++++++++++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.cpp | 16 ++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/aligner.cpp | 10 +++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.cpp | 16 ++++++++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/tester.cpp | 15 +++++++++++++
doc/examples/cmake-multiple-shared-libraries/trace.sh | 9 ++++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp | 6 ++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.h | 27 +++++++++++++++++++++++
12 files changed, 200 insertions(+)
Philippe Proulx
2016-06-17 14:25:39 UTC
Permalink
On Fri, Jun 17, 2016 at 12:09 AM, Sebastien Boisvert
Post by Sebastien Boisvert
Hi Mathieu,
Isn't the "standard" way to use CMake this, in terms of directories:

mkdir build
cd build
cmake ..
make

?

Also, just a note: CMake 3.6 will have a FindLTTngUST [1] module which defines
an `LTTng::UST` imported target. This should be more robust than just:

target_link_libraries(tracepoint-provider dl lttng-ust)

About this line, by the way, you should at least use `${CMAKE_DL_LIBS}` instead
of `dl`.

Phil
Post by Sebastien Boisvert
The following changes since commit 01f0e40ce5b0c30c7c0706b63532049b311c83cf
are available in the git repository at
https://github.com/sebhtml/lttng-ust.git
tags/cmake-multiple-shared-libraries.2016-06-17
Doc: add CMake example
Doc: clean up cmake example
Doc: add a trace.sh script in the cmake example
Doc: clean up cmake file
Doc: fix English issue
Doc: rename cmake example
Doc: ship cmake example with 'make distcheck'
doc/examples/Makefile.am | 15 +++++++++++++
doc/examples/cmake-multiple-shared-libraries/CMakeLists.txt | 20
+++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/README.md | 52
+++++++++++++++++++++++++++++++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.cpp | 16 ++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/aligner.cpp | 10 +++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.cpp | 16 ++++++++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/tester.cpp | 15 +++++++++++++
doc/examples/cmake-multiple-shared-libraries/trace.sh | 9 ++++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp | 6 ++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.h | 27
+++++++++++++++++++++++
12 files changed, 200 insertions(+)
_______________________________________________
lttng-dev mailing list
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Philippe Proulx
2016-06-17 14:45:15 UTC
Permalink
On Fri, Jun 17, 2016 at 10:25 AM, Philippe Proulx
Post by Philippe Proulx
On Fri, Jun 17, 2016 at 12:09 AM, Sebastien Boisvert
Post by Sebastien Boisvert
Hi Mathieu,
mkdir build
cd build
cmake ..
make
?
Also, just a note: CMake 3.6 will have a FindLTTngUST [1] module which defines
[1] https://github.com/Kitware/CMake/blob/master/Modules/FindLTTngUST.cmake
Post by Philippe Proulx
target_link_libraries(tracepoint-provider dl lttng-ust)
About this line, by the way, you should at least use `${CMAKE_DL_LIBS}` instead
of `dl`.
Phil
Post by Sebastien Boisvert
The following changes since commit 01f0e40ce5b0c30c7c0706b63532049b311c83cf
are available in the git repository at
https://github.com/sebhtml/lttng-ust.git
tags/cmake-multiple-shared-libraries.2016-06-17
Doc: add CMake example
Doc: clean up cmake example
Doc: add a trace.sh script in the cmake example
Doc: clean up cmake file
Doc: fix English issue
Doc: rename cmake example
Doc: ship cmake example with 'make distcheck'
doc/examples/Makefile.am | 15 +++++++++++++
doc/examples/cmake-multiple-shared-libraries/CMakeLists.txt | 20
+++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/README.md | 52
+++++++++++++++++++++++++++++++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.cpp | 16 ++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/aligner.cpp | 10 +++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.cpp | 16 ++++++++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/tester.cpp | 15 +++++++++++++
doc/examples/cmake-multiple-shared-libraries/trace.sh | 9 ++++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp | 6 ++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.h | 27
+++++++++++++++++++++++
12 files changed, 200 insertions(+)
_______________________________________________
lttng-dev mailing list
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Sebastien Boisvert
2016-06-17 14:52:06 UTC
Permalink
Hi Phil,
Post by Philippe Proulx
On Fri, Jun 17, 2016 at 12:09 AM, Sebastien Boisvert
Post by Sebastien Boisvert
Hi Mathieu,
mkdir build
cd build
cmake ..
make
?
I can rename the directory from cmake-multiple-shared-libraries.build to build.

I don't know if it is standard to create the build directory inside the source tree.
I always do out-of-tree builds, but I don't know if it is incoherent with the standard way.

Either way, I will make the changes you think are required.
Post by Philippe Proulx
Also, just a note: CMake 3.6 will have a FindLTTngUST [1] module which defines
I will add a check to detect CMake >= 3.6 and use find_package(LTTngUST) in that case.
Post by Philippe Proulx
target_link_libraries(tracepoint-provider dl lttng-ust)
About this line, by the way, you should at least use `${CMAKE_DL_LIBS}` instead
of `dl`.
I will do this.


Thanks
Post by Philippe Proulx
Phil
Post by Sebastien Boisvert
The following changes since commit 01f0e40ce5b0c30c7c0706b63532049b311c83cf
are available in the git repository at
https://github.com/sebhtml/lttng-ust.git
tags/cmake-multiple-shared-libraries.2016-06-17
Doc: add CMake example
Doc: clean up cmake example
Doc: add a trace.sh script in the cmake example
Doc: clean up cmake file
Doc: fix English issue
Doc: rename cmake example
Doc: ship cmake example with 'make distcheck'
doc/examples/Makefile.am | 15 +++++++++++++
doc/examples/cmake-multiple-shared-libraries/CMakeLists.txt | 20
+++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/README.md | 52
+++++++++++++++++++++++++++++++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.cpp | 16 ++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/aligner.cpp | 10 +++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.cpp | 16 ++++++++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/tester.cpp | 15 +++++++++++++
doc/examples/cmake-multiple-shared-libraries/trace.sh | 9 ++++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp | 6 ++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.h | 27
+++++++++++++++++++++++
12 files changed, 200 insertions(+)
_______________________________________________
lttng-dev mailing list
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Philippe Proulx
2016-06-17 15:00:33 UTC
Permalink
On Fri, Jun 17, 2016 at 10:52 AM, Sebastien Boisvert
Post by Sebastien Boisvert
Hi Phil,
Post by Philippe Proulx
On Fri, Jun 17, 2016 at 12:09 AM, Sebastien Boisvert
Post by Sebastien Boisvert
Hi Mathieu,
mkdir build
cd build
cmake ..
make
?
I can rename the directory from cmake-multiple-shared-libraries.build to build.
I don't know if it is standard to create the build directory inside the source tree.
I always do out-of-tree builds, but I don't know if it is incoherent with the standard way.
Either way, I will make the changes you think are required.
It's just something that I see often in simple examples, so it might be
a good idea to conform to this.
Post by Sebastien Boisvert
Post by Philippe Proulx
Also, just a note: CMake 3.6 will have a FindLTTngUST [1] module which defines
I will add a check to detect CMake >= 3.6 and use find_package(LTTngUST) in that case.
CMake 3.6 is not released yet, and when it does, few people will have
access to it
in the beginning I guess. You could include the whole module in the
example directory
(in a `CMake/modules` directory, for example), and still require CMake
2.8.11. Eventually
when CMake 3.6 is available on all major distributions then we can switch to a
requirement of CMake 3.6 and use the built-in module. What do you think?
Post by Sebastien Boisvert
Post by Philippe Proulx
target_link_libraries(tracepoint-provider dl lttng-ust)
About this line, by the way, you should at least use `${CMAKE_DL_LIBS}` instead
of `dl`.
I will do this.
Note however that the LTTng::UST imported target is linked with
`${CMAKE_DL_LIBS}` already.

Phil
Post by Sebastien Boisvert
Thanks
Post by Philippe Proulx
Phil
Post by Sebastien Boisvert
The following changes since commit 01f0e40ce5b0c30c7c0706b63532049b311c83cf
are available in the git repository at
https://github.com/sebhtml/lttng-ust.git
tags/cmake-multiple-shared-libraries.2016-06-17
Doc: add CMake example
Doc: clean up cmake example
Doc: add a trace.sh script in the cmake example
Doc: clean up cmake file
Doc: fix English issue
Doc: rename cmake example
Doc: ship cmake example with 'make distcheck'
doc/examples/Makefile.am | 15
+++++++++++++
doc/examples/cmake-multiple-shared-libraries/CMakeLists.txt | 20
+++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/README.md | 52
+++++++++++++++++++++++++++++++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.cpp | 16
++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/aligner.cpp | 10 +++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.cpp | 16
++++++++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/tester.cpp | 15
+++++++++++++
doc/examples/cmake-multiple-shared-libraries/trace.sh | 9 ++++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp | 6 ++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.h | 27
+++++++++++++++++++++++
12 files changed, 200 insertions(+)
_______________________________________________
lttng-dev mailing list
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Sebastien Boisvert
2016-06-17 15:13:47 UTC
Permalink
Post by Philippe Proulx
On Fri, Jun 17, 2016 at 10:52 AM, Sebastien Boisvert
Post by Sebastien Boisvert
Hi Phil,
Post by Philippe Proulx
On Fri, Jun 17, 2016 at 12:09 AM, Sebastien Boisvert
Post by Sebastien Boisvert
Hi Mathieu,
mkdir build
cd build
cmake ..
make
?
I can rename the directory from cmake-multiple-shared-libraries.build to build.
I don't know if it is standard to create the build directory inside the source tree.
I always do out-of-tree builds, but I don't know if it is incoherent with the standard way.
Either way, I will make the changes you think are required.
It's just something that I see often in simple examples, so it might be
a good idea to conform to this.
I'll make the change.
Post by Philippe Proulx
Post by Sebastien Boisvert
Post by Philippe Proulx
Also, just a note: CMake 3.6 will have a FindLTTngUST [1] module which defines
I will add a check to detect CMake >= 3.6 and use find_package(LTTngUST) in that case.
CMake 3.6 is not released yet, and when it does, few people will have
access to it
in the beginning I guess. You could include the whole module in the
example directory
(in a `CMake/modules` directory, for example), and still require CMake
2.8.11. Eventually
when CMake 3.6 is available on all major distributions then we can switch to a
requirement of CMake 3.6 and use the built-in module. What do you think?
I vote in favor of your solution that ships with the FindLTTngUST.cmake file and cake >= 2.8.11.

Would CMake/modules be at the root of lttng-ust/ or in lttng-ust/doc/examples ?

If this solution is chosen, I suppose that the -ldl will be taken care of by FindLTTngUST.
Post by Philippe Proulx
Post by Sebastien Boisvert
Post by Philippe Proulx
target_link_libraries(tracepoint-provider dl lttng-ust)
About this line, by the way, you should at least use `${CMAKE_DL_LIBS}` instead
of `dl`.
I will do this.
Note however that the LTTng::UST imported target is linked with
`${CMAKE_DL_LIBS}` already.
Phil
Post by Sebastien Boisvert
Thanks
Post by Philippe Proulx
Phil
Post by Sebastien Boisvert
The following changes since commit 01f0e40ce5b0c30c7c0706b63532049b311c83cf
are available in the git repository at
https://github.com/sebhtml/lttng-ust.git
tags/cmake-multiple-shared-libraries.2016-06-17
Doc: add CMake example
Doc: clean up cmake example
Doc: add a trace.sh script in the cmake example
Doc: clean up cmake file
Doc: fix English issue
Doc: rename cmake example
Doc: ship cmake example with 'make distcheck'
doc/examples/Makefile.am | 15
+++++++++++++
doc/examples/cmake-multiple-shared-libraries/CMakeLists.txt | 20
+++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/README.md | 52
+++++++++++++++++++++++++++++++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.cpp | 16
++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/aligner.cpp | 10 +++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.cpp | 16
++++++++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/tester.cpp | 15
+++++++++++++
doc/examples/cmake-multiple-shared-libraries/trace.sh | 9 ++++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp | 6 ++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.h | 27
+++++++++++++++++++++++
12 files changed, 200 insertions(+)
_______________________________________________
lttng-dev mailing list
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Philippe Proulx
2016-06-17 18:19:46 UTC
Permalink
On Fri, Jun 17, 2016 at 11:13 AM, Sebastien Boisvert
Post by Sebastien Boisvert
Post by Philippe Proulx
On Fri, Jun 17, 2016 at 10:52 AM, Sebastien Boisvert
Post by Sebastien Boisvert
Hi Phil,
Post by Philippe Proulx
On Fri, Jun 17, 2016 at 12:09 AM, Sebastien Boisvert
Post by Sebastien Boisvert
Hi Mathieu,
mkdir build
cd build
cmake ..
make
?
I can rename the directory from cmake-multiple-shared-libraries.build to build.
I don't know if it is standard to create the build directory inside the source tree.
I always do out-of-tree builds, but I don't know if it is incoherent with the standard way.
Either way, I will make the changes you think are required.
It's just something that I see often in simple examples, so it might be
a good idea to conform to this.
I'll make the change.
Post by Philippe Proulx
Post by Sebastien Boisvert
Post by Philippe Proulx
Also, just a note: CMake 3.6 will have a FindLTTngUST [1] module which defines
I will add a check to detect CMake >= 3.6 and use find_package(LTTngUST) in that case.
CMake 3.6 is not released yet, and when it does, few people will have
access to it
in the beginning I guess. You could include the whole module in the
example directory
(in a `CMake/modules` directory, for example), and still require CMake
2.8.11. Eventually
when CMake 3.6 is available on all major distributions then we can switch to a
requirement of CMake 3.6 and use the built-in module. What do you think?
I vote in favor of your solution that ships with the FindLTTngUST.cmake file and cake >= 2.8.11.
Would CMake/modules be at the root of lttng-ust/ or in lttng-ust/doc/examples ?
If this solution is chosen, I suppose that the -ldl will be taken care of by FindLTTngUST.
1. Use this CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.11)
project(ALIGNER)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

include_directories(.)

include (FindLTTngUST REQUIRED)

add_library(tracepoint-provider SHARED tracepoint-provider.cpp)
target_link_libraries(tracepoint-provider LTTng::UST)

add_library(aligner-lib SHARED aligner-lib.cpp)
target_link_libraries(aligner-lib tracepoint-provider)

add_library(tester-lib SHARED tester-lib.cpp)
target_link_libraries(tester-lib tracepoint-provider)

link_libraries(aligner-lib)

add_executable(aligner aligner.cpp)

add_executable(tester tester.cpp)
target_link_libraries(tester tester-lib)

2. In the "cmake" directory, relative to this CMakeLists.txt file, put
FindLTTngUST.cmake, but you need to replace the
FindPackageHandleStandardArgs include line because we're not in
CMake's source tree, so this is your file: <https://www.pastery.net/fvanfh/>.

Works for me:

-- Found LTTngUST: /usr/local/lib/liblttng-ust.so;dl (found version "2.8.0")

Phil
Post by Sebastien Boisvert
Post by Philippe Proulx
Post by Sebastien Boisvert
Post by Philippe Proulx
target_link_libraries(tracepoint-provider dl lttng-ust)
About this line, by the way, you should at least use `${CMAKE_DL_LIBS}` instead
of `dl`.
I will do this.
Note however that the LTTng::UST imported target is linked with
`${CMAKE_DL_LIBS}` already.
Phil
Post by Sebastien Boisvert
Thanks
Post by Philippe Proulx
Phil
Post by Sebastien Boisvert
The following changes since commit 01f0e40ce5b0c30c7c0706b63532049b311c83cf
are available in the git repository at
https://github.com/sebhtml/lttng-ust.git
tags/cmake-multiple-shared-libraries.2016-06-17
Doc: add CMake example
Doc: clean up cmake example
Doc: add a trace.sh script in the cmake example
Doc: clean up cmake file
Doc: fix English issue
Doc: rename cmake example
Doc: ship cmake example with 'make distcheck'
doc/examples/Makefile.am | 15
+++++++++++++
doc/examples/cmake-multiple-shared-libraries/CMakeLists.txt | 20
+++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/README.md | 52
+++++++++++++++++++++++++++++++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.cpp | 16
++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/aligner.cpp | 10
+++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.cpp | 16
++++++++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/tester.cpp | 15
+++++++++++++
doc/examples/cmake-multiple-shared-libraries/trace.sh | 9 ++++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp | 6 ++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.h | 27
+++++++++++++++++++++++
12 files changed, 200 insertions(+)
_______________________________________________
lttng-dev mailing list
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Sebastien Boisvert
2016-06-18 02:20:42 UTC
Permalink
Hi Phil,

I implemented all your suggestions.

I have 10 commits that are sitting on top of 21ddb8ec9689e02944dae9cd4e5aba1ca2ab0d5b .

You can pull from

https://github.com/sebhtml/lttng-ust.git tags/for-phil-cmake-example-2016-06-17.003


To see the changes in a web browser: https://github.com/sebhtml/lttng-ust/commits/for-phil-cmake-example-2016-06-17.003

Sebastien Boisvert (10):
Doc: add CMake example
Doc: clean up cmake example
Doc: add a trace.sh script in the cmake example
Doc: clean up cmake file
Doc: fix English issue
Doc: rename cmake example
Doc: ship cmake example with 'make distcheck'
Doc: add FindLTTngUST CMake module
Doc: use standard way for building with CMake
Doc: use the FindLTTngUST CMake module

doc/examples/Makefile.am | 15 +++
.../cmake-multiple-shared-libraries/CMakeLists.txt | 23 +++++
.../cmake-multiple-shared-libraries/README.md | 52 ++++++++++
.../aligner-lib.cpp | 16 +++
.../cmake-multiple-shared-libraries/aligner-lib.h | 7 ++
.../cmake-multiple-shared-libraries/aligner.cpp | 10 ++
.../cmake/FindLTTngUST.cmake | 111 +++++++++++++++++++++
.../cmake-multiple-shared-libraries/tester-lib.cpp | 16 +++
.../cmake-multiple-shared-libraries/tester-lib.h | 7 ++
.../cmake-multiple-shared-libraries/tester.cpp | 15 +++
.../cmake-multiple-shared-libraries/trace.sh | 9 ++
.../tracepoint-provider.cpp | 6 ++
.../tracepoint-provider.h | 27 +++++
13 files changed, 314 insertions(+)



Have a good one.
Post by Philippe Proulx
On Fri, Jun 17, 2016 at 11:13 AM, Sebastien Boisvert
Post by Sebastien Boisvert
Post by Philippe Proulx
On Fri, Jun 17, 2016 at 10:52 AM, Sebastien Boisvert
Post by Sebastien Boisvert
Hi Phil,
Post by Philippe Proulx
On Fri, Jun 17, 2016 at 12:09 AM, Sebastien Boisvert
Post by Sebastien Boisvert
Hi Mathieu,
mkdir build
cd build
cmake ..
make
?
I can rename the directory from cmake-multiple-shared-libraries.build to build.
I don't know if it is standard to create the build directory inside the source tree.
I always do out-of-tree builds, but I don't know if it is incoherent with the standard way.
Either way, I will make the changes you think are required.
It's just something that I see often in simple examples, so it might be
a good idea to conform to this.
I'll make the change.
Post by Philippe Proulx
Post by Sebastien Boisvert
Post by Philippe Proulx
Also, just a note: CMake 3.6 will have a FindLTTngUST [1] module which defines
I will add a check to detect CMake >= 3.6 and use find_package(LTTngUST) in that case.
CMake 3.6 is not released yet, and when it does, few people will have
access to it
in the beginning I guess. You could include the whole module in the
example directory
(in a `CMake/modules` directory, for example), and still require CMake
2.8.11. Eventually
when CMake 3.6 is available on all major distributions then we can switch to a
requirement of CMake 3.6 and use the built-in module. What do you think?
I vote in favor of your solution that ships with the FindLTTngUST.cmake file and cake >= 2.8.11.
Would CMake/modules be at the root of lttng-ust/ or in lttng-ust/doc/examples ?
If this solution is chosen, I suppose that the -ldl will be taken care of by FindLTTngUST.
cmake_minimum_required(VERSION 2.8.11)
project(ALIGNER)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include_directories(.)
include (FindLTTngUST REQUIRED)
add_library(tracepoint-provider SHARED tracepoint-provider.cpp)
target_link_libraries(tracepoint-provider LTTng::UST)
add_library(aligner-lib SHARED aligner-lib.cpp)
target_link_libraries(aligner-lib tracepoint-provider)
add_library(tester-lib SHARED tester-lib.cpp)
target_link_libraries(tester-lib tracepoint-provider)
link_libraries(aligner-lib)
add_executable(aligner aligner.cpp)
add_executable(tester tester.cpp)
target_link_libraries(tester tester-lib)
2. In the "cmake" directory, relative to this CMakeLists.txt file, put
FindLTTngUST.cmake, but you need to replace the
FindPackageHandleStandardArgs include line because we're not in
CMake's source tree, so this is your file: <https://www.pastery.net/fvanfh/>.
-- Found LTTngUST: /usr/local/lib/liblttng-ust.so;dl (found version "2.8.0")
Phil
Post by Sebastien Boisvert
Post by Philippe Proulx
Post by Sebastien Boisvert
Post by Philippe Proulx
target_link_libraries(tracepoint-provider dl lttng-ust)
About this line, by the way, you should at least use `${CMAKE_DL_LIBS}` instead
of `dl`.
I will do this.
Note however that the LTTng::UST imported target is linked with
`${CMAKE_DL_LIBS}` already.
Phil
Post by Sebastien Boisvert
Thanks
Post by Philippe Proulx
Phil
Post by Sebastien Boisvert
The following changes since commit 01f0e40ce5b0c30c7c0706b63532049b311c83cf
are available in the git repository at
https://github.com/sebhtml/lttng-ust.git
tags/cmake-multiple-shared-libraries.2016-06-17
Doc: add CMake example
Doc: clean up cmake example
Doc: add a trace.sh script in the cmake example
Doc: clean up cmake file
Doc: fix English issue
Doc: rename cmake example
Doc: ship cmake example with 'make distcheck'
doc/examples/Makefile.am | 15
+++++++++++++
doc/examples/cmake-multiple-shared-libraries/CMakeLists.txt | 20
+++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/README.md | 52
+++++++++++++++++++++++++++++++++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.cpp | 16
++++++++++++++
doc/examples/cmake-multiple-shared-libraries/aligner-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/aligner.cpp | 10
+++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.cpp | 16
++++++++++++++
doc/examples/cmake-multiple-shared-libraries/tester-lib.h | 7 ++++++
doc/examples/cmake-multiple-shared-libraries/tester.cpp | 15
+++++++++++++
doc/examples/cmake-multiple-shared-libraries/trace.sh | 9
++++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp | 6 ++++++
doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.h | 27
+++++++++++++++++++++++
12 files changed, 200 insertions(+)
_______________________________________________
lttng-dev mailing list
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Loading...