cmake builds and installs differently when uses cmake
Looks like all Linux distrinutions are using bootstrap script to build and install cmake.
I found that cmake provides own cmake build and install cmake suite so theoretically it is possible to build and install cmake using cmake. One of the reasons to do that is it is not possible pass AR, RANLIB, NM variables which are necessary on trying to build cmake with LTO optimisation #18712. So trying to build cmake with LTO optimisation I've turned to build cmake using cmake by execute:
+ CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' + export CFLAGS + CXXFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' + export CXXFLAGS + FFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules' + export FFLAGS + FCFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules' + export FCFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto -fuse-linker-plugin' + export LDFLAGS + /usr/bin/cmake -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DLIB_SUFFIX=64 -DBUILD_SHARED_LIBS:BOOL=ON .. -DBUILD_CursesDialog:BOOL=OFF -DBUILD_QtDialog:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DCMAKE_USE_SYSTEM_BZIP2:BOOL=OFF -DCMAKE_USE_SYSTEM_CURL:BOOL=ON -DCMAKE_USE_SYSTEM_EXPAT:BOOL=ON -DCMAKE_USE_SYSTEM_FORM:BOOL=ON -DCMAKE_USE_SYSTEM_JSONCPP:BOOL=ON -DCMAKE_USE_SYSTEM_LIBARCHIVE:BOOL=ON -DCMAKE_USE_SYSTEM_LIBLZMA:BOOL=ON -DCMAKE_USE_SYSTEM_LIBRHASH:BOOL=ON -DCMAKE_USE_SYSTEM_LIBUV:BOOL=ON -DCMAKE_USE_SYSTEM_ZLIB:BOOL=ON -DCMake_RUN_CLANG_TIDY:BOOL=OFF -DCMake_RUN_IWYU:BOOL=OFF -DENABLE_THREADED_RESOLVER:BOOL=ON -DSPHINX_HTML:BOOL=OFF -DSPHINX_INFO:BOOL=ON -DSPHINX_MAN:BOOL=ON -DUSE_NGHTTP2:BOOL=OFF
After I've build successfully cmake using cmake I foud that in directory structure generated using boostrap and cmake is different.
Here is directories tree when boostrap is used:
[tkloczko@barrel cmake-3.14.2-2.fc31.x86_64]$ tree -d . └── usr ├── bin ├── doc │ └── cmake-3.14 │ ├── cmcompress │ └── cmsys ├── info ├── lib64 │ └── cmake ├── man │ ├── man1 │ └── man7 └── share ├── aclocal ├── bash-completion │ └── completions ├── cmake-3.14 │ ├── completions │ ├── editors │ │ ├── emacs │ │ └── vim │ │ ├── indent │ │ └── syntax │ ├── Help │ │ ├── command │ │ ├── cpack_gen │ │ ├── envvar │ │ ├── generator │ │ ├── include │ │ ├── manual │ │ ├── module │ │ ├── policy │ │ ├── prop_cache │ │ ├── prop_dir │ │ ├── prop_gbl │ │ ├── prop_inst │ │ ├── prop_sf │ │ ├── prop_test │ │ ├── prop_tgt │ │ ├── release │ │ └── variable │ ├── include │ ├── Modules │ │ ├── AndroidTestUtilities │ │ ├── CheckIPOSupported │ │ ├── CMakeAddFortranSubdirectory │ │ ├── Compiler │ │ ├── CompilerId │ │ ├── FetchContent │ │ ├── FindCUDA │ │ ├── FindMPI │ │ ├── FindPython │ │ ├── FortranCInterface │ │ │ └── Verify │ │ ├── IntelVSImplicitPath │ │ ├── Internal │ │ │ └── CPack │ │ ├── Platform │ │ │ └── Android │ │ └── UseSWIG │ └── Templates │ ├── MSBuild │ │ └── FlagTables │ └── Windows └── doc └── cmake 66 directories
and cmake:
[tkloczko@barrel cmake-3.14.2-2.fc31.x86_64]$ tree -d . └── usr ├── bin ├── doc │ └── cmake-3.14 │ ├── cmcompress │ └── cmsys ├── info ├── lib64 │ └── cmake ├── man │ ├── man1 │ └── man7 └── share ├── aclocal ├── bash-completion │ └── completions ├── cmake-3.14 │ ├── completions │ ├── editors │ │ ├── emacs │ │ └── vim │ │ ├── indent │ │ └── syntax │ ├── Help │ │ ├── command │ │ ├── cpack_gen │ │ ├── envvar │ │ ├── generator │ │ ├── include │ │ ├── manual │ │ ├── module │ │ ├── policy │ │ ├── prop_cache │ │ ├── prop_dir │ │ ├── prop_gbl │ │ ├── prop_inst │ │ ├── prop_sf │ │ ├── prop_test │ │ ├── prop_tgt │ │ ├── release │ │ └── variable │ ├── include │ ├── Modules │ │ ├── AndroidTestUtilities │ │ ├── CheckIPOSupported │ │ ├── CMakeAddFortranSubdirectory │ │ ├── Compiler │ │ ├── CompilerId │ │ ├── FetchContent │ │ ├── FindCUDA │ │ ├── FindMPI │ │ ├── FindPython │ │ ├── FortranCInterface │ │ │ └── Verify │ │ ├── IntelVSImplicitPath │ │ ├── Internal │ │ │ └── CPack │ │ ├── Platform │ │ │ └── Android │ │ └── UseSWIG │ └── Templates │ ├── MSBuild │ │ └── FlagTables │ └── Windows └── doc └── cmake 66 directories
Differensies:
- cmake insyall all cmake data files in
/usr/share/cmake-<version>
and boostrap in /usr/share/cmake - cmake installs man info pages in /usr/{man,info} and boostrap in /usr/share/{man,info}
Looks like not to amey people are trying to build cmake using cmake :/