ITADN

CMake improvements

#354OpenRoEdAl 创建于 2025-07-06
R
RoEdAlcommented
I decided to make some changes in `CMake` script. You may find these in my repo (`cmake` branch): https://github.com/RoEdAl/v4l2rtspserver/tree/cmake. # Description 1. CMake: do not define `CMAKE_BUILD_TYPE` Do **not** set `CMAKE_BUILD_TYPE` variable to *Release*. When this variable isn't set compilation flags are taken from `CFLAGS`, `CXXFLAGS` and `LDFLAGS` environment variables. This is the way to customize compilation flags. I'm using this method to compile binaries using the same compilation flags as *Debian* uses to build packages. You may still use *Release* build type by specifying it explicitly. 2. CMake: always define `VERSION` macro Allows to build project outside git repository. Now building project outside repository isn't possible due to lack of `VERSION` macro. 3. CMake: Init submodules only if git command is available When building project outside git repository. Do not invoke git to initialize submodules. 4. CMake: Use *imported targets* defined by `find_package` command This is just small improvement. *Imported targets* may contain additional macro definitions and includes. Unfortunately, in order to use `ALSA::ALSA` imported target version **3.12** (or above) of *CMake* is required. ---- Could I create PR with these changes?
1 条评论