mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Introduce `CMD_STRICT` to act as a parent for warnings about allowed but disrecommended usage. Introduce a warning that discourages use of non-target directives (which modify the build environment for the entire [sub]tree). Add notes to the official documentation recommending use of target-specific alternatives. This has been accepted wisdom for quite some time, but only some of the affected commands made any mention of this in the documentation.
20 lines
506 B
CMake
20 lines
506 B
CMake
cmake_minimum_required(VERSION 4.4)
|
|
project(NonTargetDirectives)
|
|
|
|
# Test diagnostics for non-target directives. Note that, because we don't
|
|
# need to actually compile anything, it doesn't matter if we use options,
|
|
# directories, or libraries that don't exist.
|
|
|
|
add_definitions(-DFOO)
|
|
|
|
add_compile_definitions(BAR)
|
|
add_compile_options(-fPIC)
|
|
|
|
add_link_options(-Wl,--no-undefined)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/include)
|
|
|
|
link_directories(${CMAKE_SOURCE_DIR}/lib)
|
|
|
|
link_libraries(/usr/lib/libm.so)
|