[lttng-dev] [lttng-ust GIT PULL] Doc: add a CMake example

Sebastien Boisvert sboisvert at gydle.com
Fri Jun 17 15:13:47 UTC 2016



On 06/17/2016 11:00 AM, Philippe Proulx wrote:
> On Fri, Jun 17, 2016 at 10:52 AM, Sebastien Boisvert
> <sboisvert at gydle.com> wrote:
>> Hi Phil,
>>
>> On 06/17/2016 10:25 AM, Philippe Proulx wrote:
>>> On Fri, Jun 17, 2016 at 12:09 AM, Sebastien Boisvert
>>> <sboisvert at gydle.com> wrote:
>>>> Hi Mathieu,
>>>>
>>>> Please pull 7 commits for a new example in the documentation:
>>>
>>> Isn't the "standard" way to use CMake this, in terms of directories:
>>>
>>>     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.

> 
>>
>>>
>>> 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:
>>>
>>
>> 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.

> 
>>
>>>     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
> 
>>
>>
>> Thanks
>>
>>
>>
>>> Phil
>>>
>>>>
>>>>
>>>> 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(+)
>>>> _______________________________________________
>>>> lttng-dev mailing list
>>>> lttng-dev at lists.lttng.org
>>>> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


More information about the lttng-dev mailing list