Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DoomSlayer6665676/aa92aba999c28d60f6cc68c490398e1f to your computer and use it in GitHub Desktop.
Save DoomSlayer6665676/aa92aba999c28d60f6cc68c490398e1f to your computer and use it in GitHub Desktop.
lab06
┌──(kali㉿kali)-[~]
└─$ export GITHUB_USERNAME=DoomSlayer6665676
export GITHUB_EMAIL=dmitryvasilev5676@gmail.com
┌──(kali㉿kali)-[~]
└─$ alias edit=nano
┌──(kali㉿kali)-[~]
└─$ alias gsed=sed
┌──(kali㉿kali)-[~]
└─$ cd ${GITHUB_USERNAME}/workspace
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace]
└─$ pushd .
~/DoomSlayer6665676/workspace ~/DoomSlayer6665676/workspace
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace]
└─$ source scripts/activate
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace]
└─$ git clone https://github.com/${GITHUB_USERNAME}/lab05 projects/lab06
Cloning into 'projects/lab06'...
remote: Enumerating objects: 28, done.
remote: Counting objects: 100% (28/28), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 28 (delta 7), reused 28 (delta 7), pack-reused 0 (from 0)
Receiving objects: 100% (28/28), done.
Resolving deltas: 100% (7/7), done.
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace]
└─$ cd projects/lab06
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ git remote remove origin
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ git remote add origin https://github.com/${GITHUB_USERNAME}/lab06
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ gsed -i '/project(print)/a\
set(PRINT_VERSION_STRING "v\${PRINT_VERSION}")
' CMakeLists.txt
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ gsed -i '/project(print)/a\
set(PRINT_VERSION\
\${PRINT_VERSION_MAJOR}.\${PRINT_VERSION_MINOR}.\${PRINT_VERSION_PATCH}.\${PRINT_VERSION_TWEAK})
' CMakeLists.txt
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ gsed -i '/project(print)/a\
set(PRINT_VERSION_TWEAK 0)
' CMakeLists.txt
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ gsed -i '/project(print)/a\
set(PRINT_VERSION_PATCH 0)
' CMakeLists.txt
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ gsed -i '/project(print)/a\
set(PRINT_VERSION_MINOR 1)
' CMakeLists.txt
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ gsed -i '/project(print)/a\
set(PRINT_VERSION_MAJOR 0)
' CMakeLists.txt
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2ae72ea..f4de956 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,12 @@
cmake_minimum_required(VERSION 3.16)
project(print)
+set(PRINT_VERSION_MAJOR 0)
+set(PRINT_VERSION_MINOR 1)
+set(PRINT_VERSION_PATCH 0)
+set(PRINT_VERSION_TWEAK 0)
+set(PRINT_VERSION
+ ${PRINT_VERSION_MAJOR}.${PRINT_VERSION_MINOR}.${PRINT_VERSION_PATCH}.${PRINT_VERSION_TWEAK})
+set(PRINT_VERSION_STRING "v${PRINT_VERSION}")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ touch DESCRIPTION && edit DESCRIPTION
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ touch ChangeLog.md
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ export DATE="`LANG=en_US date +'%a %b %d %Y'`"
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cat > ChangeLog.md <<EOF
* ${DATE} ${GITHUB_USERNAME} <${GITHUB_EMAIL}> 0.1.0.0
- Initial RPM release
EOF
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cat > CPackConfig.cmake <<EOF
include(InstallRequiredSystemLibraries)
EOF
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cat >> CPackConfig.cmake <<EOF
set(CPACK_PACKAGE_CONTACT ${GITHUB_EMAIL})
set(CPACK_PACKAGE_VERSION_MAJOR \${PRINT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR \${PRINT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH \${PRINT_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION_TWEAK \${PRINT_VERSION_TWEAK})
set(CPACK_PACKAGE_VERSION \${PRINT_VERSION})
set(CPACK_PACKAGE_DESCRIPTION_FILE \${CMAKE_CURRENT_SOURCE_DIR}/DESCRIPTION)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "static C++ library for printing")
EOF
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cat >> CPackConfig.cmake <<EOF
set(CPACK_RESOURCE_FILE_LICENSE \${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
set(CPACK_RESOURCE_FILE_README \${CMAKE_CURRENT_SOURCE_DIR}/README.md)
EOF
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cat >> CPackConfig.cmake <<EOF
set(CPACK_RPM_PACKAGE_NAME "print-devel")
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
set(CPACK_RPM_PACKAGE_GROUP "print")
set(CPACK_RPM_CHANGELOG_FILE \${CMAKE_CURRENT_SOURCE_DIR}/ChangeLog.md)
set(CPACK_RPM_PACKAGE_RELEASE 1)
EOF
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cat >> CPackConfig.cmake <<EOF
set(CPACK_DEBIAN_PACKAGE_NAME "libprint-dev")
set(CPACK_DEBIAN_PACKAGE_PREDEPENDS "cmake >= 3.0")
set(CPACK_DEBIAN_PACKAGE_RELEASE 1)
EOF
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cat >> CPackConfig.cmake <<EOF
include(CPack)
EOF
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cat >> CMakeLists.txt <<EOF
include(CPackConfig.cmake)
EOF
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ gsed -i 's/lab05/lab06/g' README.md
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ git add .
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ git commit -m"added cpack config"
[main 8579ef0] added cpack config
4 files changed, 35 insertions(+)
create mode 100644 CPackConfig.cmake
create mode 100644 ChangeLog.md
create mode 100644 DESCRIPTION
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ git tag v0.1.0.0
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ git push origin main --tags
Username for 'https://github.com':
Password for 'https://github.com':
remote: No anonymous write access.
fatal: Authentication failed for 'https://github.com/DoomSlayer6665676/lab06/'
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ git push origin main --tags
Username for 'https://github.com': DoomSlayer6665676
Password for 'https://DoomSlayer6665676@github.com':
Enumerating objects: 34, done.
Counting objects: 100% (34/34), done.
Delta compression using up to 4 threads
Compressing objects: 100% (20/20), done.
Writing objects: 100% (34/34), 3.94 KiB | 3.94 MiB/s, done.
Total 34 (delta 9), reused 26 (delta 7), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (9/9), done.
To https://github.com/DoomSlayer6665676/lab06
* [new branch] main -> main
* [new tag] v0.1.0.0 -> v0.1.0.0
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cmake -H. -B_build
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:33 (target_compile_options):
Cannot specify compile options for target "gtest" which is not built by
this project.
CMake Error at /usr/share/cmake-3.31/Modules/CPack.cmake:688 (message):
CPack license resource file:
"/home/kali/DoomSlayer6665676/workspace/projects/lab06/LICENSE" could not
be found.
Call Stack (most recent call first):
/usr/share/cmake-3.31/Modules/CPack.cmake:693 (cpack_check_file_exists)
CPackConfig.cmake:24 (include)
CMakeLists.txt:36 (include)
-- Configuring incomplete, errors occurred!
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ sudo apt-get install libgtest-dev libgmock-dev
[sudo] password for kali:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libgtest-dev is already the newest version (1.16.0-1).
libgmock-dev is already the newest version (1.16.0-1).
The following packages were automatically installed and are no longer required:
icu-devtools libabsl20230802 libdnnl3 libflac12t64 libfuse3-3 libgeos3.13.0 libglapi-mesa libicu-dev libjxl0.10
liblbfgsb0 libopenh264-7 libpoppler145 libpython3.12-minimal libpython3.12-stdlib libpython3.12t64 libxnnpack0
python3-setproctitle python3.12-tk ruby-zeitwerk strongswan
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 67 not upgraded.
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ nano CMakeLists.txt
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ touch LICENSE
echo "MIT License" > LICENSE
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ nano CMakeLists.txt
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ rm -rf _build
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cmake -H. -B_build
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:34 (target_compile_options):
Cannot specify compile options for target "gtest" which is not built by
this project.
-- Configuring incomplete, errors occurred!
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ nano CMakeLists.txt
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ rm -rf _build
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cmake -H. -B_build
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at /usr/share/cmake-3.31/Modules/FetchContent.cmake:1373 (message):
The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
not set. The policy's OLD behavior will be used. When using a URL
download, the timestamps of extracted files should preferably be that of
the time of extraction, otherwise code that depends on the extracted
contents might not be rebuilt if the URL changes. The OLD behavior
preserves the timestamps from the archive instead, but this is usually not
what you want. Update your project to the NEW behavior or specify the
DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
robustness issue.
Call Stack (most recent call first):
CMakeLists.txt:17 (FetchContent_Declare)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Error at CMakeLists.txt:22 (target_link_libraries):
Cannot specify link libraries for target
"ваш_исполняемый_файл" which is not built by this
project.
-- Configuring incomplete, errors occurred!
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ nano CMakeLists.txt
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ rm -rf _build
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cmake -H. -B_build
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at /usr/share/cmake-3.31/Modules/FetchContent.cmake:1373 (message):
The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
not set. The policy's OLD behavior will be used. When using a URL
download, the timestamps of extracted files should preferably be that of
the time of extraction, otherwise code that depends on the extracted
contents might not be rebuilt if the URL changes. The OLD behavior
preserves the timestamps from the archive instead, but this is usually not
what you want. Update your project to the NEW behavior or specify the
DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
robustness issue.
Call Stack (most recent call first):
CMakeLists.txt:17 (FetchContent_Declare)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Error at CMakeLists.txt:22 (target_link_libraries):
Syntax error in cmake code at
/home/kali/DoomSlayer6665676/workspace/projects/lab06/CMakeLists.txt:22
when parsing string
${${PROJECT_NAME}
There is an unterminated variable reference.
-- Configuring incomplete, errors occurred!
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ nano CMakeLists.txt
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ rm -rf _build
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cmake -H. -B_build
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:39 (target_compile_options):
Cannot specify compile options for target "gtest" which is not built by
this project.
-- Configuring incomplete, errors occurred!
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ nano CMakeLists.txt
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ rm -rf _build
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cmake -H. -B_build
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at /usr/share/cmake-3.31/Modules/FetchContent.cmake:1373 (message):
The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
not set. The policy's OLD behavior will be used. When using a URL
download, the timestamps of extracted files should preferably be that of
the time of extraction, otherwise code that depends on the extracted
contents might not be rebuilt if the URL changes. The OLD behavior
preserves the timestamps from the archive instead, but this is usually not
what you want. Update your project to the NEW behavior or specify the
DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
robustness issue.
Call Stack (most recent call first):
CMakeLists.txt:24 (FetchContent_Declare)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Error at CMakeLists.txt:28 (target_link_libraries):
Syntax error in cmake code at
/home/kali/DoomSlayer6665676/workspace/projects/lab06/CMakeLists.txt:28
when parsing string
${${PROJECT_NAME}
There is an unterminated variable reference.
-- Configuring incomplete, errors occurred!
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ nano CMakeLists.txt
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ rm -rf _build
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cmake -H. -B_build
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at /usr/share/cmake-3.31/Modules/FetchContent.cmake:1373 (message):
The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
not set. The policy's OLD behavior will be used. When using a URL
download, the timestamps of extracted files should preferably be that of
the time of extraction, otherwise code that depends on the extracted
contents might not be rebuilt if the URL changes. The OLD behavior
preserves the timestamps from the archive instead, but this is usually not
what you want. Update your project to the NEW behavior or specify the
DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
robustness issue.
Call Stack (most recent call first):
CMakeLists.txt:24 (FetchContent_Declare)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done (2.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/kali/DoomSlayer6665676/workspace/projects/lab06/_build
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cmake --build _build
[ 7%] Building CXX object CMakeFiles/print.dir/sources/print.cpp.o
[ 14%] Linking CXX static library libprint.a
[ 14%] Built target print
[ 21%] Building CXX object CMakeFiles/example1.dir/examples/example1.cpp.o
[ 28%] Linking CXX executable example1
[ 28%] Built target example1
[ 35%] Building CXX object CMakeFiles/example2.dir/examples/example2.cpp.o
[ 42%] Linking CXX executable example2
[ 42%] Built target example2
[ 50%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 57%] Linking CXX static library ../../../lib/libgtest.a
[ 57%] Built target gtest
[ 64%] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o
[ 71%] Linking CXX static library ../../../lib/libgmock.a
[ 71%] Built target gmock
[ 78%] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock_main.dir/src/gmock_main.cc.o
[ 85%] Linking CXX static library ../../../lib/libgmock_main.a
[ 85%] Built target gmock_main
[ 92%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[100%] Linking CXX static library ../../../lib/libgtest_main.a
[100%] Built target gtest_main
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cd _build
┌──(kali㉿kali)-[~/…/workspace/projects/lab06/_build]
└─$ cpack -G "TGZ"
CPack Error: CPack project name not specified
┌──(kali㉿kali)-[~/…/workspace/projects/lab06/_build]
└─$ nano ~/DoomSlayer6665676/workspace/projects/lab06/CMakeLists.txt
┌──(kali㉿kali)-[~/…/workspace/projects/lab06/_build]
└─$ touch ~/DoomSlayer6665676/workspace/projects/lab06/LICENSE
┌──(kali㉿kali)-[~/…/workspace/projects/lab06/_build]
└─$ cd ~/DoomSlayer6665676/workspace/projects/lab06
rm -rf _build
cmake -H. -B_build
cmake --build _build
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at /usr/share/cmake-3.31/Modules/FetchContent.cmake:1373 (message):
The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
not set. The policy's OLD behavior will be used. When using a URL
download, the timestamps of extracted files should preferably be that of
the time of extraction, otherwise code that depends on the extracted
contents might not be rebuilt if the URL changes. The OLD behavior
preserves the timestamps from the archive instead, but this is usually not
what you want. Update your project to the NEW behavior or specify the
DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
robustness issue.
Call Stack (most recent call first):
CMakeLists.txt:29 (FetchContent_Declare)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done (2.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/kali/DoomSlayer6665676/workspace/projects/lab06/_build
[ 7%] Building CXX object CMakeFiles/print.dir/sources/print.cpp.o
[ 14%] Linking CXX static library libprint.a
[ 14%] Built target print
[ 21%] Building CXX object CMakeFiles/example1.dir/examples/example1.cpp.o
[ 28%] Linking CXX executable example1
[ 28%] Built target example1
[ 35%] Building CXX object CMakeFiles/example2.dir/examples/example2.cpp.o
[ 42%] Linking CXX executable example2
[ 42%] Built target example2
[ 50%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 57%] Linking CXX static library ../../../lib/libgtest.a
[ 57%] Built target gtest
[ 64%] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o
[ 71%] Linking CXX static library ../../../lib/libgmock.a
[ 71%] Built target gmock
[ 78%] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock_main.dir/src/gmock_main.cc.o
[ 85%] Linking CXX static library ../../../lib/libgmock_main.a
[ 85%] Built target gmock_main
[ 92%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[100%] Linking CXX static library ../../../lib/libgtest_main.a
[100%] Built target gtest_main
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cd _build
┌──(kali㉿kali)-[~/…/workspace/projects/lab06/_build]
└─$ cpack -G "TGZ"
CPack: Create package using TGZ
CPack: Install projects
CPack Error: Not enough items on list: CPACK_INSTALL_CMAKE_PROJECTS. CPACK_INSTALL_CMAKE_PROJECTS should hold quadruplet of install directory, install project name, install component, and install subdirectory.
CPack Error: Error when generating package:
┌──(kali㉿kali)-[~/…/workspace/projects/lab06/_build]
└─$ nano ~/DoomSlayer6665676/workspace/projects/lab06/CMakeLists.txt
┌──(kali㉿kali)-[~/…/workspace/projects/lab06/_build]
└─$ nano ~/DoomSlayer6665676/workspace/projects/lab06/CMakeLists.txt
┌──(kali㉿kali)-[~/…/workspace/projects/lab06/_build]
└─$ rm ~/DoomSlayer6665676/workspace/projects/lab06/CMakeLists.txt
┌──(kali㉿kali)-[~/…/workspace/projects/lab06/_build]
└─$ nano ~/DoomSlayer6665676/workspace/projects/lab06/CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(print)
set(PRINT_VERSION_MAJOR 0)
set(PRINT_VERSION_MINOR 1) # Исправлено: было PRINT_VERSION_MINOR
set(PRINT_VERSION_PATCH 0)
set(PRINT_VERSION_TWEAK 0)
set(PRINT_VERSION ${PRINT_VERSION_MAJOR}.${PRINT_VERSION_MINOR}.${PRINT_VERSION_PATCH}.${PRINT_VERSION_TWEAK})
set(PRINT_VERSION_STRING "v${PRINT_VERSION}")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_library(print STATIC ${CMAKE_CURRENT_SOURCE_DIR}/sources/print.cpp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
add_executable(example1 ${CMAKE_CURRENT_SOURCE_DIR}/examples/example1.cpp)
add_executable(example2 ${CMAKE_CURRENT_SOURCE_DIR}/examples/example2.cpp)
target_link_libraries(example1 print)
target_link_libraries(example2 print)
# CPack настройки
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION "1.0.0")
set(CPACK_PACKAGE_CONTACT "dmitryvasilev5676@gmail.com")
set(CPACK_GENERATOR "TGZ")
include(CPack)
# Google Test
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/heads/main.zip
)
FetchContent_MakeAvailable(googletest)
if(BUILD_TESTS)
enable_testing()
add_subdirectory(third-party/gtest)
file(GLOB ${PROJECT_NAME}_TEST_SOURCES tests/*.cpp)
add_executable(check ${${PROJECT_NAME}_TEST_SOURCES})
add_test(NAME check COMMAND check)
target_link_libraries(check ${PROJECT_NAME} gtest gtest_main) # Исправлено: убрано ${}
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(check PRIVATE -Wno-error=maybe-uninitialized) # Исправлено: для check, а не gtest
endif()
endif()
┌──(kali㉿kali)-[~/…/workspace/projects/lab06/_build]
└─$ cd ..
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ touch LICENSE
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ rm -rf _build
cmake -H. -B_build
cmake --build _build
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at /usr/share/cmake-3.31/Modules/FetchContent.cmake:1373 (message):
The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
not set. The policy's OLD behavior will be used. When using a URL
download, the timestamps of extracted files should preferably be that of
the time of extraction, otherwise code that depends on the extracted
contents might not be rebuilt if the URL changes. The OLD behavior
preserves the timestamps from the archive instead, but this is usually not
what you want. Update your project to the NEW behavior or specify the
DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
robustness issue.
Call Stack (most recent call first):
CMakeLists.txt:30 (FetchContent_Declare)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done (1.6s)
-- Generating done (0.0s)
-- Build files have been written to: /home/kali/DoomSlayer6665676/workspace/projects/lab06/_build
[ 7%] Building CXX object CMakeFiles/print.dir/sources/print.cpp.o
[ 14%] Linking CXX static library libprint.a
[ 14%] Built target print
[ 21%] Building CXX object CMakeFiles/example1.dir/examples/example1.cpp.o
[ 28%] Linking CXX executable example1
[ 28%] Built target example1
[ 35%] Building CXX object CMakeFiles/example2.dir/examples/example2.cpp.o
[ 42%] Linking CXX executable example2
[ 42%] Built target example2
[ 50%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 57%] Linking CXX static library ../../../lib/libgtest.a
[ 57%] Built target gtest
[ 64%] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o
[ 71%] Linking CXX static library ../../../lib/libgmock.a
[ 71%] Built target gmock
[ 78%] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock_main.dir/src/gmock_main.cc.o
[ 85%] Linking CXX static library ../../../lib/libgmock_main.a
[ 85%] Built target gmock_main
[ 92%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[100%] Linking CXX static library ../../../lib/libgtest_main.a
[100%] Built target gtest_main
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cd _build
cpack -G "TGZ"
CPack: Create package using TGZ
CPack: Install projects
CPack: - Run preinstall target for: print
CPack: - Install project: print []
CPack: Create package
CPack: - package: /home/kali/DoomSlayer6665676/workspace/projects/lab06/_build/print-1.0.0-Linux.tar.gz generated.
┌──(kali㉿kali)-[~/…/workspace/projects/lab06/_build]
└─$ cd ..
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cmake -H. -B_build -DCPACK_GENERATOR="TGZ"
CMake Warning (dev) at /usr/share/cmake-3.31/Modules/FetchContent.cmake:1373 (message):
The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
not set. The policy's OLD behavior will be used. When using a URL
download, the timestamps of extracted files should preferably be that of
the time of extraction, otherwise code that depends on the extracted
contents might not be rebuilt if the URL changes. The OLD behavior
preserves the timestamps from the archive instead, but this is usually not
what you want. Update your project to the NEW behavior or specify the
DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
robustness issue.
Call Stack (most recent call first):
CMakeLists.txt:30 (FetchContent_Declare)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/kali/DoomSlayer6665676/workspace/projects/lab06/_build
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ cmake --build _build --target package
[ 14%] Built target print
[ 28%] Built target example1
[ 42%] Built target example2
[ 57%] Built target gtest
[ 71%] Built target gmock
[ 85%] Built target gmock_main
[100%] Built target gtest_main
Run CPack packaging tool...
CPack: Create package using TGZ
CPack: Install projects
CPack: - Run preinstall target for: print
CPack: - Install project: print []
CPack: Create package
CPack: - package: /home/kali/DoomSlayer6665676/workspace/projects/lab06/_build/print-1.0.0-Linux.tar.gz generated.
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ mkdir artifacts
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ mv _build/*.tar.gz artifacts
┌──(kali㉿kali)-[~/DoomSlayer6665676/workspace/projects/lab06]
└─$ tree artifacts
artifacts
└── print-1.0.0-Linux.tar.gz
1 directory, 1 file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment