OlivierLDff / asio.cmake

Small CMake wrapper to add asio with a simple FetchContent.
MIT License
17 stars 8 forks source link

add install target too #6

Closed ClausKlein closed 2 years ago

ClausKlein commented 2 years ago

use origin CPM.cmake url use newest CMake properties if available fix typo

OlivierLDff commented 2 years ago

I thank you for the PR. This is indeed a great idea. Would it be possible to separate in different PR

And I don't think it is a good idea to index the version of asio.cmake to the version of asio, otherwise this script version can't evolve independently.

ClausKlein commented 2 years ago

I have no time to create separate MR. The install is now optional and only available if CPM.cmake is used!

OlivierLDff commented 2 years ago

So I merged everything in #10 #9 #8 #7 Thank you for the suggestion. I'm going to do a breaking release that change default for the repository to use CPM by default. Tell me if you think something is missing.

ClausKlein commented 2 years ago

Tell me if you think something is missing.

INCLUDE_HEADER_PATTERN "*.hpp" with this option, are you sure that none of the *.ipp header are needed!

OlivierLDff commented 2 years ago

Aren't ipp compiled already?

ClausKlein commented 2 years ago

Aren't ipp compiled already?

Yes, perfect. I have checked it:

Claus-iMac:asio.cmake clausklein$ ll standalone
lrwxr-xr-x  1 clausklein  staff  13  7 Sep 07:45 standalone -> tests/install
Claus-iMac:asio.cmake clausklein$ cmake -S standalone -B ./cmake-build-asio.cmake-x86_64-Debug/standalone -G Ninja -D CMAKE_CXX_COMPILER_LAUNCHER=/usr/local/bin/ccache -D CMAKE_EXPORT_COMPILE_COMMANDS=1 -D CMAKE_BUILD_TYPE=Debug -D CMAKE_PREFIX_PATH=/Users/clausklein/Workspace/cpp/asio.cmake/stage -D BUILD_TESTING=1 -D CMAKE_CXX_STANDARD=20
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_TESTING

-- Build files have been written to: /Users/clausklein/Workspace/cpp/asio.cmake/cmake-build-asio.cmake-x86_64-Debug/standalone
Claus-iMac:asio.cmake clausklein$ ninja -C cmake-build-asio.cmake-x86_64-Debug/standalone
ninja: Entering directory `cmake-build-asio.cmake-x86_64-Debug/standalone'
[2/2] Linking CXX executable time_t_timer
Claus-iMac:asio.cmake clausklein$ cd cmake-build-asio.cmake-x86_64-Debug/standalone
Claus-iMac:standalone clausklein$ ninja -t deps | grep -w asio | grep -vw hpp
    /Users/clausklein/Workspace/cpp/asio.cmake/standalone/time_t_timer.cpp
Claus-iMac:standalone clausklein$ ninja clean
[1/1] Cleaning all built files...
Cleaning... 2 files.
Claus-iMac:standalone clausklein$ ninja -nv
[1/2] /usr/local/bin/ccache /Applications/Xcode.app/Contents/Developer/usr/bin/g++ -DASIO_NO_DEPRECATED -DASIO_SEPARATE_COMPILATION -DASIO_STANDALONE -isystem /Users/clausklein/Workspace/cpp/asio.cmake/stage/include -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -std=gnu++20 -MD -MT CMakeFiles/time_t_timer.dir/time_t_timer.cpp.o -MF CMakeFiles/time_t_timer.dir/time_t_timer.cpp.o.d -o CMakeFiles/time_t_timer.dir/time_t_timer.cpp.o -c /Users/clausklein/Workspace/cpp/asio.cmake/standalone/time_t_timer.cpp
[2/2] : && /Applications/Xcode.app/Contents/Developer/usr/bin/g++ -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/time_t_timer.dir/time_t_timer.cpp.o -o time_t_timer  /Users/clausklein/Workspace/cpp/asio.cmake/stage/lib/asio/libasio.a && :
Claus-iMac:standalone clausklein$ 
OlivierLDff commented 2 years ago

I think it was covered with the https://github.com/OlivierLDff/asio.cmake/blob/aee5a9802ec1322264fa18b8c61bda1af66f580f/tests/install/CMakeLists.txt#L1-L5 test case I added (it also run in CI)

OlivierLDff commented 2 years ago

I merged your latest commit in https://github.com/OlivierLDff/asio.cmake/pull/12 For using upstream cpm, I like having all the code I use on my github, so it is easy to backup.

ClausKlein commented 2 years ago

For using upstream cpm, I like having all the code I use on my github, so it is easy to backup. You may exchange the CPM.cmake bootstrap module with the real CPM.cmake module.