Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include missing GNUInstallDirs #105

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

ClausKlein
Copy link
Contributor

add symlink to Index.cmake to enable use with CPM.cmake module too

This fix #104 too

test/CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@aminya aminya added the bug Something isn't working label Mar 17, 2022
@ClausKlein ClausKlein requested a review from aminya March 19, 2022 18:40
@ClausKlein ClausKlein marked this pull request as draft March 20, 2022 19:37
@ClausKlein
Copy link
Contributor Author

ClausKlein commented Mar 20, 2022

NOTE: with ENABLE_INTERPROCEDURAL_OPTIMIZATION it fails on on CI macOS-11 llvm!
see https://github.com/aminya/project_options/runs/5640388101?check_suite_focus=true

On my iMac with AppleClang 13.1.6 it builds without errors:

task: [clean] 
  rm -rf ./test/build ./test_install/build


task: [test_install] cmake ./test_install -B ./test_install/build -DCMAKE_BUILD_TYPE:STRING=Release -G "Ninja Multi-Config" -DCMAKE_PREFIX_PATH:STRING=/Users/clausklein/cmake/cmakelib/install;
-- vcpkg is already installed at /Users/clausklein/vcpkg.
-- Running vcpkg install
Detecting compiler hash for triplet x64-osx...
The following packages will be built and installed:
    eigen3[core]:x64-osx -> 3.4.0 -- /Users/clausklein/vcpkg/buildtrees/versioning_/versions/eigen3/0475ed327bda734cad0acd35978cde9379bc8619
    fmt[core]:x64-osx -> 8.1.1 -- /Users/clausklein/vcpkg/buildtrees/versioning_/versions/fmt/9748716da169977423d02b3c3f0de7b7f274e34e
  * vcpkg-cmake[core]:x64-osx -> 2022-01-19 -- /Users/clausklein/vcpkg/buildtrees/versioning_/versions/vcpkg-cmake/b7c050fe60f91dcedef6d87a3f87584151bf8aee
  * vcpkg-cmake-config[core]:x64-osx -> 2022-01-30 -- /Users/clausklein/vcpkg/buildtrees/versioning_/versions/vcpkg-cmake-config/fea8f92ffa5e14c7111fe526f8cc93ecd8f9dbf0
Additional packages (*) will be modified to complete this operation.
Restored 4 packages from /Users/clausklein/.cache/vcpkg/archives in 342.4 ms. Use --debug to see more details.
Starting package 1/4: vcpkg-cmake-config:x64-osx
Installing package vcpkg-cmake-config[core]:x64-osx...
Elapsed time for package vcpkg-cmake-config:x64-osx: 1.793 ms
Starting package 2/4: vcpkg-cmake:x64-osx
Installing package vcpkg-cmake[core]:x64-osx...
Elapsed time for package vcpkg-cmake:x64-osx: 2.448 ms
Starting package 3/4: eigen3:x64-osx
Installing package eigen3[core]:x64-osx...
Elapsed time for package eigen3:x64-osx: 256.1 ms
Starting package 4/4: fmt:x64-osx
Installing package fmt[core]:x64-osx...
Elapsed time for package fmt:x64-osx: 7.538 ms

Total elapsed time: 2.455 s

The package eigen3 provides CMake targets:

    find_package(Eigen3 CONFIG REQUIRED)
    target_link_libraries(main PRIVATE Eigen3::Eigen)

The package fmt provides CMake targets:

    find_package(fmt CONFIG REQUIRED)
    target_link_libraries(main PRIVATE fmt::fmt)

    # Or use the header-only version
    find_package(fmt CONFIG REQUIRED)
    target_link_libraries(main PRIVATE fmt::fmt-header-only)

-- Running vcpkg install - done
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- The C 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
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- The default CMAKE_C_STANDARD used by external targets and tools is not set yet. Using the latest supported C standard that is 17
-- Downloading conan.cmake from https://github.com/conan-io/cmake-conan
-- Conan: Adding cci remote repository (https://center.conan.io) verify ssl (True)
-- Conan: Adding bincrafters remote repository (https://bincrafters.jfrog.io/artifactory/api/conan/public-conan) verify ssl (True)
-- Multi-configuration build: 'Debug;Release;RelWithDebInfo'!
-- Running Conan for build type 'Debug'
-- Conan: checking conan executable
-- Conan: Found program /usr/local/bin/conan
-- Conan: Version found Conan version 1.43.0
-- Conan executing: /usr/local/bin/conan install /Users/clausklein/cmake/cmakelib/test_install --build missing --env CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc --env CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ --settings build_type=Debug --settings compiler=apple-clang --settings compiler.version=13.1 --settings compiler.libcxx=libc++ --settings compiler.cppstd=20
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=apple-clang
compiler.cppstd=20
compiler.libcxx=libc++
compiler.version=13.1
os=Macos
os_build=Macos
[options]
*:cxx_20=True
*:header_only=True
*:shared=True
[build_requires]
[env]
CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
CONAN_CMAKE_GENERATOR=Ninja
CONAN_RUN_TESTS=True
CONAN_USERNAME=clausklein
CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
conanfile.txt: Installing package
Requirements
    docopt.cpp/0.6.3 from 'cci' - Cache
Packages
    docopt.cpp/0.6.3:327be534101cf95794d221297b3fee0c042051bb - Cache

Installing (downloading, building) binaries...
docopt.cpp/0.6.3: Already installed!
conanfile.txt: Generator txt created conanbuildinfo.txt
conanfile.txt: Generator cmake_find_package_multi created docopt-config-version.cmake
conanfile.txt: Generator cmake_find_package_multi created docoptTarget-debug.cmake
conanfile.txt: Generator cmake_find_package_multi created docoptTargets.cmake
conanfile.txt: Generator cmake_find_package_multi created docopt-config.cmake
conanfile.txt: Aggregating env generators
conanfile.txt: Generated conaninfo.txt
conanfile.txt: Generated graphinfo
-- Running Conan for build type 'Release'
-- Conan: checking conan executable
-- Conan: Found program /usr/local/bin/conan
-- Conan: Version found Conan version 1.43.0
-- Conan executing: /usr/local/bin/conan install /Users/clausklein/cmake/cmakelib/test_install --build missing --env CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc --env CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ --settings build_type=Release --settings compiler=apple-clang --settings compiler.version=13.1 --settings compiler.libcxx=libc++ --settings compiler.cppstd=20
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=20
compiler.libcxx=libc++
compiler.version=13.1
os=Macos
os_build=Macos
[options]
*:cxx_20=True
*:header_only=True
*:shared=True
[build_requires]
[env]
CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
CONAN_CMAKE_GENERATOR=Ninja
CONAN_RUN_TESTS=True
CONAN_USERNAME=clausklein
CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
conanfile.txt: Installing package
Requirements
    docopt.cpp/0.6.3 from 'cci' - Cache
Packages
    docopt.cpp/0.6.3:f765955ff23f6de8b1b8a81bc0639af6c2866059 - Cache

Installing (downloading, building) binaries...
docopt.cpp/0.6.3: Already installed!
conanfile.txt: Generator txt created conanbuildinfo.txt
conanfile.txt: Generator cmake_find_package_multi created docopt-config-version.cmake
conanfile.txt: Generator cmake_find_package_multi created docoptTarget-release.cmake
conanfile.txt: Generator cmake_find_package_multi created docoptTargets.cmake
conanfile.txt: Generator cmake_find_package_multi created docopt-config.cmake
conanfile.txt: Aggregating env generators
conanfile.txt: Generated conaninfo.txt
conanfile.txt: Generated graphinfo
-- Running Conan for build type 'RelWithDebInfo'
-- Conan: checking conan executable
-- Conan: Found program /usr/local/bin/conan
-- Conan: Version found Conan version 1.43.0
-- Conan executing: /usr/local/bin/conan install /Users/clausklein/cmake/cmakelib/test_install --build missing --env CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc --env CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ --settings build_type=RelWithDebInfo --settings compiler=apple-clang --settings compiler.version=13.1 --settings compiler.libcxx=libc++ --settings compiler.cppstd=20
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=RelWithDebInfo
compiler=apple-clang
compiler.cppstd=20
compiler.libcxx=libc++
compiler.version=13.1
os=Macos
os_build=Macos
[options]
*:cxx_20=True
*:header_only=True
*:shared=True
[build_requires]
[env]
CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
CONAN_CMAKE_GENERATOR=Ninja
CONAN_RUN_TESTS=True
CONAN_USERNAME=clausklein
CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
conanfile.txt: Installing package
Requirements
    docopt.cpp/0.6.3 from 'cci' - Cache
Packages
    docopt.cpp/0.6.3:5daf637a62aba772e1702099bde4503471cf3546 - Cache

Installing (downloading, building) binaries...
docopt.cpp/0.6.3: Already installed!
conanfile.txt: Generator cmake_find_package_multi created docopt-config-version.cmake
conanfile.txt: Generator cmake_find_package_multi created docoptTarget-relwithdebinfo.cmake
conanfile.txt: Generator cmake_find_package_multi created docoptTargets.cmake
conanfile.txt: Generator cmake_find_package_multi created docopt-config.cmake
conanfile.txt: Generator txt created conanbuildinfo.txt
conanfile.txt: Aggregating env generators
conanfile.txt: Generated conaninfo.txt
conanfile.txt: Generated graphinfo
-- Library docopt found /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/327be534101cf95794d221297b3fee0c042051bb/lib/libdocopt.dylib
-- Found: /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/327be534101cf95794d221297b3fee0c042051bb/lib/libdocopt.dylib
-- Library docopt found /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/327be534101cf95794d221297b3fee0c042051bb/lib/libdocopt.dylib
-- Found: /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/327be534101cf95794d221297b3fee0c042051bb/lib/libdocopt.dylib
-- Library docopt found /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/f765955ff23f6de8b1b8a81bc0639af6c2866059/lib/libdocopt.dylib
-- Found: /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/f765955ff23f6de8b1b8a81bc0639af6c2866059/lib/libdocopt.dylib
-- Library docopt found /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/f765955ff23f6de8b1b8a81bc0639af6c2866059/lib/libdocopt.dylib
-- Found: /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/f765955ff23f6de8b1b8a81bc0639af6c2866059/lib/libdocopt.dylib
-- Library docopt found /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/5daf637a62aba772e1702099bde4503471cf3546/lib/libdocopt.dylib
-- Found: /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/5daf637a62aba772e1702099bde4503471cf3546/lib/libdocopt.dylib
-- Library docopt found /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/5daf637a62aba772e1702099bde4503471cf3546/lib/libdocopt.dylib
-- Found: /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/5daf637a62aba772e1702099bde4503471cf3546/lib/libdocopt.dylib
-- Library docopt found /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/327be534101cf95794d221297b3fee0c042051bb/lib/libdocopt.dylib
-- Skipping already existing target: CONAN_LIB::docopt_docopt_DEBUG
-- Found: /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/327be534101cf95794d221297b3fee0c042051bb/lib/libdocopt.dylib
-- Library docopt found /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/327be534101cf95794d221297b3fee0c042051bb/lib/libdocopt.dylib
-- Skipping already existing target: CONAN_LIB::docopt_docopt_docoptDEBUG
-- Found: /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/327be534101cf95794d221297b3fee0c042051bb/lib/libdocopt.dylib
-- Library docopt found /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/f765955ff23f6de8b1b8a81bc0639af6c2866059/lib/libdocopt.dylib
-- Skipping already existing target: CONAN_LIB::docopt_docopt_RELEASE
-- Found: /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/f765955ff23f6de8b1b8a81bc0639af6c2866059/lib/libdocopt.dylib
-- Library docopt found /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/f765955ff23f6de8b1b8a81bc0639af6c2866059/lib/libdocopt.dylib
-- Skipping already existing target: CONAN_LIB::docopt_docopt_docoptRELEASE
-- Found: /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/f765955ff23f6de8b1b8a81bc0639af6c2866059/lib/libdocopt.dylib
-- Library docopt found /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/5daf637a62aba772e1702099bde4503471cf3546/lib/libdocopt.dylib
-- Skipping already existing target: CONAN_LIB::docopt_docopt_RELWITHDEBINFO
-- Found: /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/5daf637a62aba772e1702099bde4503471cf3546/lib/libdocopt.dylib
-- Library docopt found /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/5daf637a62aba772e1702099bde4503471cf3546/lib/libdocopt.dylib
-- Skipping already existing target: CONAN_LIB::docopt_docopt_docoptRELWITHDEBINFO
-- Found: /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/5daf637a62aba772e1702099bde4503471cf3546/lib/libdocopt.dylib
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/clausklein/cmake/cmakelib/test_install/build
task: [test_install] cmake --build ./test_install/build --config Release
[2/2] Linking CXX executable Release/another_main
task: [test_install] cd ./test_install/build && ctest -C Release --verbose
UpdateCTestConfiguration  from :/Users/clausklein/cmake/cmakelib/test_install/build/DartConfiguration.tcl
UpdateCTestConfiguration  from :/Users/clausklein/cmake/cmakelib/test_install/build/DartConfiguration.tcl
Test project /Users/clausklein/cmake/cmakelib/test_install/build
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 1
    Start 1: another_main

1: Test command: /Users/clausklein/cmake/cmakelib/test_install/build/Release/another_main
1: Test timeout computed to be: 10000000
1: Hello from fmt!       0
1: 0.111111
1: 0.222222
1: 0.333333
1: 0.444444
1: 0.555556
1: 0.666667
1: 0.777778
1: 0.888889
1:        1Hello from fmt!       0
1: 0.111111
1: 0.222222
1: 0.333333
1: 0.444444
1: 0.555556
1: 0.666667
1: 0.777778
1: 0.888889
1:        1
1/1 Test #1: another_main .....................   Passed    0.16 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.16 sec
bash-3.2$ history 2
  725  task --taskfile Taskfile.yml test_install
  726  history 2
bash-3.2$ 

@ClausKlein ClausKlein force-pushed the feature/fix-interface-include-directory-path branch from 0b13b34 to 3699531 Compare March 21, 2022 05:52
@ClausKlein ClausKlein marked this pull request as ready for review March 23, 2022 19:27
cmds:
- task: test_release
- cmake --install ./test/build --config Release --prefix ./install
- task: clean
Copy link
Owner

@aminya aminya Mar 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why clean after installation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had tests in past, that used libs or header from build directory and not from installed prefix .
This guaranties that nothing is used from build dir after install.
In our case, with code coverage compile options, the installed library contents use the build dir while running test_install project!
That was there reason why I disabled some options.

Comment on lines 38 to 43
ENABLE_COVERAGE
ENABLE_PCH
PCH_HEADERS
${PCH_HEADERS}
# TODO(CK: should not installed with this option!) ENABLE_COVERAGE
# TBD: ENABLE_PCH
# TBD: PCH_HEADERS ${PCH_HEADERS}
ENABLE_DOXYGEN
ENABLE_INTERPROCEDURAL_OPTIMIZATION
ENABLE_NATIVE_OPTIMIZATION
# ENABLE_INTERPROCEDURAL_OPTIMIZATION
# ENABLE_NATIVE_OPTIMIZATION
Copy link
Owner

@aminya aminya Mar 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ClausKlein Please revert all unnecessary changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were build errors on OSX, no idea why!
The linker crashed while build release.

And PCH interfere with clang-tidy on my iMac. see #107

@ClausKlein ClausKlein requested a review from aminya March 24, 2022 13:02
@aminya aminya self-assigned this Mar 27, 2022
Copy link
Owner

@aminya aminya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#116 was merged, which includes a part of this PR.

This should be cleaned up to include only the necessary changes. It might be easier to create a new clean PR.

@ClausKlein ClausKlein force-pushed the feature/fix-interface-include-directory-path branch from 522fd98 to 9cbc9c2 Compare April 4, 2022 06:30
test/CMakeLists.txt Outdated Show resolved Hide resolved
disable doxygen
rebased with master
tested with cmake 3.23 on OSX
@ClausKlein ClausKlein force-pushed the feature/fix-interface-include-directory-path branch from 152f92e to 9662284 Compare May 7, 2022 19:41
@ClausKlein ClausKlein requested a review from aminya May 13, 2022 07:27
Copy link
Owner

@aminya aminya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cannot be merged as it is now. I want to add an INSTALL_DIRS option to project_options with some possible values (e.g. GNU). This way, people can pass other possible install dirs possibilities. This should be done in a separate pull request.

@ClausKlein
Copy link
Contributor Author

OK

@ClausKlein ClausKlein closed this May 15, 2022
@aminya aminya reopened this May 16, 2022
@aminya
Copy link
Owner

aminya commented May 16, 2022

Please keep it open so it is not lost.

@aminya aminya added the blocked label May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

the test_install does not build (include path wrong set in cmake config package)
2 participants