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

cmake: Policy CMP0115 set to OLD behavior for dlt-daemon with cmake >= 3.20 #510

Merged

Conversation

minminlittleshrimp
Copy link
Collaborator

Starting in CMake 3.20, CMake prefers all source files to have their extensions explicitly listed (.c,.cpp,etc). To keep dlt-daemon silently built, set this Policy to OLD.

@minminlittleshrimp
Copy link
Collaborator Author

Logs in Deb:Sid (book worm):

root@lum3hc-VirtualBox:/home/lum3hc/work/docker/dlt-daemon/build# cmake .. -DWITH_DLT_UNIT_TESTS=ON
CMake Deprecation Warning at CMakeLists.txt:16 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Using pthread_setname_np API to set thread name
-- The Gtest version 1.13.0 is not compatible with current implementation, preparing Gtest v1.11.0
-- Submodule update
CMake Deprecation Warning at googletest/CMakeLists.txt:4 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Deprecation Warning at googletest/googletest/CMakeLists.txt:56 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Could NOT find Python (missing: Python_EXECUTABLE Interpreter) 
-- 
-- -------------------------------------------------------------------------------
-- Build for Version 2.18.9 build  version state STABLE
-- WITH_SYSTEMD = OFF
-- WITH_SYSTEMD_WATCHDOG = OFF
-- WITH_SYSTEMD_JOURNAL = OFF
-- WITH_DOC = OFF
-- WITH_MAN = OFF
-- WITH_DLT_ADAPTOR = OFF
-- WITH_DLT_ADAPTOR_UDP = OFF
-- WITH_DLT_CONSOLE = ON
-- WITH_DLT_CONSOLE_WO_CTRL = OFF
-- WITH_DLT_CONSOLE_WO_SBTM = OFF
-- WITH_DLT_EXAMPLES = ON
-- WITH_DLT_SYSTEM = OFF
-- WITH_DLT_FILETRANSFER = OFF
-- WITH_DLT_DBUS = OFF
-- WITH_DLT_TESTS = ON
-- WITH_DLT_UNIT_TESTS = ON
-- GTEST_VERSION = 1.13.0
-- WITH_DLT_COVERAGE = OFF
-- WITH_DLT_SHM_ENABLE = OFF
-- WITH_DLTTEST = OFF
-- BUILD_GMOCK = OFF
-- WITH_GIT_SUBMODULE = ON
-- WITH_DLT_PKGCONFIG = ON
-- WITH_DLT_CXX11_EXT = OFF
-- WITH_DLT_COREDUMPHANDLER = OFF
-- WITH_DLT_KPI = OFF
-- WITH_DLT_FATAL_LOG_TRAP = OFF
-- WITH_CHECK_CONFIG_FILE = OFF
-- WITH_TESTSCRIPTS = OFF
-- WITH_GPROF = OFF
-- WITH_DLT_USE_IPv6 = ON
-- DLT_USER = genivi
-- BUILD_SHARED_LIBS = ON
-- TARGET_CPU_NAME = 
-- CMAKE_INSTALL_PREFIX = /usr/local
-- CMAKE_BUILD_TYPE = RelWithDebInfo
-- CMAKE_HOST_SYSTEM_PROCESSOR = x86_64
-- CMAKE_SYSTEM_PROCESSOR = x86_64
-- WITH_DLT_LOGSTORAGE_CTRL_UDEV = OFF
-- WITH_DLT_LOGSTORAGE_GZIP = OFF
-- DLT_IPC = FIFO(Path: /tmp)
-- WITH_DLT_DAEMON_VSOCK_IPC = OFF
-- WITH_DLT_LIB_VSOCK_IPC = OFF
-- DLT_VSOCK_PORT = 13490
-- WITH_UDP_CONNECTION = OFF
-- WITH_DLT_QNX_SYSTEM = OFF
-- WITH_DLT_NETWORK_TRACE = ON
-- WITH_LIB_SHORT_VERSION = OFF
-- WITH_LEGACY_INCLUDE_PATH = ON
-- WITH_EXTENDED_FILTERING = OFF
-- WITH_DLT_DISABLE_MACRO = OFF
-- WITH_DLT_FILE_LOGGING_SYSLOG_FALLBACK = OFF
-- WITH_DLT_LOG_LEVEL_APP_CONFIG = OFF
-- Change a value with: cmake -D<Variable>=<Value>
-- -------------------------------------------------------------------------------
-- 
-- Configuring done (0.1s)
CMake Warning (dev) at src/console/CMakeLists.txt:46 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/console/dlt-receive.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/console/CMakeLists.txt:46 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/console/dlt-convert.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/console/CMakeLists.txt:46 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/console/dlt-control.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/console/CMakeLists.txt:46 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/console/dlt-passive-node-ctrl.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/console/CMakeLists.txt:46 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/console/dlt-sortbytimestamp.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/examples/CMakeLists.txt:29 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/examples/dlt-example-user-func.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/examples/CMakeLists.txt:29 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/examples/dlt-example-filetransfer.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/examples/CMakeLists.txt:29 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/examples/dlt-example-user.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/examples/CMakeLists.txt:29 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/examples/dlt-example-user-common-api.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/tests/CMakeLists.txt:48 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/tests/dlt-test-multi-process.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/tests/CMakeLists.txt:48 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/tests/dlt-test-multi-process-client.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/tests/CMakeLists.txt:48 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/tests/dlt-test-user.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/tests/CMakeLists.txt:48 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/tests/dlt-test-client.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/tests/CMakeLists.txt:48 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/tests/dlt-test-stress-user.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/tests/CMakeLists.txt:48 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/tests/dlt-test-stress-client.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/tests/CMakeLists.txt:48 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/tests/dlt-test-stress.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/tests/CMakeLists.txt:48 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/tests/dlt-test-fork-handler.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/tests/CMakeLists.txt:48 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/tests/dlt-test-init-free.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/tests/CMakeLists.txt:48 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/tests/dlt-test-preregister-context.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/tests/CMakeLists.txt:48 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/tests/dlt-test-filetransfer.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at src/tests/CMakeLists.txt:48 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/src/tests/dlt-test-non-verbose.c
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:50 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/tests/gtest_dlt_common.cpp
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:50 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/tests/gtest_dlt_user.cpp
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:50 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/tests/gtest_dlt_daemon_common.cpp
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:50 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/tests/dlt_env_ll_unit_test.cpp
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:70 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/tests/gtest_dlt_daemon_gateway.cpp
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:70 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/tests/gtest_dlt_daemon_offline_log.cpp
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:70 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/tests/gtest_dlt_daemon_event_handler.cpp
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:70 (add_executable):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /home/lum3hc/work/docker/dlt-daemon/tests/gtest_dlt_daemon_multiple_files_logging.cpp
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done (0.0s)
-- Build files have been written to: /home/lum3hc/work/docker/dlt-daemon/build

Some information about this Policy:

#cmake --help-policy CMP0115 
CMP0115
-------

.. versionadded:: 3.20

Source file extensions must be explicit.

In CMake 3.19 and below, if a source file could not be found by the name
specified, it would append a list of known extensions to the name to see if
the file with the extension could be found. For example, this would allow the
user to run:

 add_executable(exe main)

and put ``main.c`` in the executable without specifying the extension.

Starting in CMake 3.20, CMake prefers all source files to have their extensions
explicitly listed:

 add_executable(exe main.c)

The ``OLD`` behavior for this policy is to implicitly append known extensions
to source files if they can't be found. The ``NEW`` behavior of this policy is
to not append known extensions and require them to be explicit.

This policy was introduced in CMake version 3.20.  CMake version 3.27.1
warns when the policy is not set and uses ``OLD`` behavior. Use the
``cmake_policy()`` command to set it to ``OLD`` or ``NEW`` explicitly.

.. note::
  The ``OLD`` behavior of a policy is
  ``deprecated by definition``
  and may be removed in a future version of CMake.

@minminlittleshrimp minminlittleshrimp self-assigned this Jul 27, 2023
@lvklevankhanh
Copy link
Contributor

lvklevankhanh commented Jul 27, 2023

Hello @minminlittleshrimp ,
I applied your changes to the dlt-daemon on my local machine (Ubuntu16.4) and the following issue occurred.

cmake ..
CMake Error at CMakeLists.txt:18 (cmake_policy):
Policy "CMP0115" is not known to this version of CMake.
...
-- Configuring incomplete, errors occurred!

Please check this issue from your side.
Regards,

@minminlittleshrimp
Copy link
Collaborator Author

Hello a.Khanh,
I fixed the issue, please kindly check again.
Regards

@lvklevankhanh
Copy link
Contributor

Hello a.Khanh, I fixed the issue, please kindly check again. Regards

Hello @minminlittleshrimp ,
I am using the cmake version: cmake version 3.5.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).

It still got the error as:

CMake Error at CMakeLists.txt:18 (if):
if given arguments:

"3.5.1" "VERSION_GREATER_EQUAL" "3.20"

Unknown arguments specified

-- Configuring incomplete, errors occurred!
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target 'install'. Stop.

Please kindly check this issue from your side.
Regards,

@minminlittleshrimp minminlittleshrimp changed the title cmake: Policy CMP0115 set to OLD behavior for dlt-daemon debian package cmake: Policy CMP0115 set to OLD behavior for dlt-daemon with cmake >= 3.20 Jul 28, 2023
Starting in CMake 3.20, CMake prefers all source files
to have their extensions explicitly listed (.c,.cpp,etc).
To keep dlt-daemon silently built, set this Policy to OLD.

Signed-off-by: LUU QUANG MINH <[email protected]>
@minminlittleshrimp
Copy link
Collaborator Author

Hello @lvklevankhanh
I update the patch, VERSION_GREATER_EQUAL only available from cmake 3.7, hence I modified so that it is backward compatible. Please kindly check to see if the issue with cmake 3.5 gone.
Regards

@michael-methner michael-methner merged commit 774fe31 into COVESA:master Aug 2, 2023
@minminlittleshrimp minminlittleshrimp deleted the cmake_policy_CMP0115 branch July 3, 2024 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants