intitle:"EvoCam" inurl:"webcam.html"
Evocams !
install(FILES "$CMAKE_CURRENT_BINARY_DIR/MyProjectConfigVersion.cmake" DESTINATION lib/cmake/MyProject ) CMake’s built-in testing is trivial to use:
add_library(utils STATIC utils.cpp) target_include_directories(utils PUBLIC include/private) # Both utils and my_app need it target_compile_definitions(utils PRIVATE UTILS_BUILD=1) add_executable(my_app main.cpp) target_link_libraries(my_app PRIVATE utils) # utils's PUBLIC includes propagate A master-level CMake project looks like this: mastering cmake pdf
"version": 3, "configurePresets": [ "name": "debug", "displayName": "Debug", "generator": "Ninja", "binaryDir": "$sourceDir/build/debug", "cacheVariables": "CMAKE_BUILD_TYPE": "Debug", "BUILD_TESTS": "ON" , "name": "release", "inherits": "debug", "displayName": "Release", "binaryDir": "$sourceDir/build/release", "cacheVariables": "CMAKE_BUILD_TYPE": "Release" ], "buildPresets": [ "name": "debug", "configurePreset": "debug" , "name": "release", "configurePreset": "release" ] "configurePresets": [ "name": "debug"
find_path(MyLib_INCLUDE_DIR mylib.h PATHS /usr/include /usr/local/include) find_library(MyLib_LIBRARY mylib PATHS /usr/lib /usr/local/lib) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(MyLib DEFAULT_MSG MyLib_LIBRARY MyLib_INCLUDE_DIR) "cacheVariables": "CMAKE_BUILD_TYPE": "Debug"
add_executable(my_app main.cpp) target_include_directories(my_app PRIVATE include) target_link_directories(my_app PRIVATE /custom/lib) Why? Target properties don’t pollute sibling directories or subprojects. | Modifier | Effect | |------------|-------------------------------------------------------------------------| | PRIVATE | Used only by this target, not by dependents (e.g., internal .cpp includes) | | PUBLIC | Used by this target and all dependents (e.g., header include dirs) | | INTERFACE | Used only by dependents, not by this target (e.g., header-only libs) |
add_executable(test_core test_core.cpp) target_link_libraries(test_core PRIVATE core) add_test(NAME CoreSanity COMMAND test_core) add_test(NAME CoreEdgeCase COMMAND test_core --edge) Presets: The Future of CMake Workflows (3.19+) CMakePresets.json standardizes configuring, building, and testing across teams:
: