"Fossies" - the Fresh Open Source Software Archive

Member "brlcad-7.32.4/misc/CMake/NOTES" (29 Jul 2021, 897 Bytes) of package /linux/misc/brlcad-7.32.4.tar.bz2:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 Right now we have scripts that need to redirect their
    2 output referencing the file written out by a custom
    3 build target to indicate the current build type.  We
    4 might instead be able to pass that information in as
    5 a define using the $<CONFIG> generator expression (or
    6 maybe more than just that one if that's not enough
    7 for MSVC).
    8 
    9 CMakeLists.txt:
   10 add_custom_command(
   11 	OUTPUT script_type.txt
   12 	COMMAND ${CMAKE_COMMAND} -DBUILD_TYPE="$<CONFIG>" -P ${CMAKE_SOURCE_DIR}/script.cmake
   13 	)
   14 add_custom_target(script DEPENDS script_type.txt)
   15 
   16 script.cmake:
   17 message("BUILD_TYPE: ${BUILD_TYPE}")
   18 file(WRITE script_type.txt "${BUILD_TYPE}")
   19 
   20 output:
   21 
   22 cmake .. -DCMAKE_BUILD_TYPE=Debug && make script
   23 [100%] Generating script_type.txt
   24 BUILD_TYPE: Debug
   25 [100%] Built target script
   26 
   27 cmake .. -DCMAKE_BUILD_TYPE=Release && make script
   28 [100%] Generating script_type.txt
   29 BUILD_TYPE: Release
   30 [100%] Built target script
   31