CMake Tutorial EP 4 | Versioning Source Code

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 พ.ย. 2024

ความคิดเห็น • 23

  • @dmcdcm
    @dmcdcm 3 ปีที่แล้ว +37

    just fyi, this vid has highest vid quality of 360p. sometimes i dont notice when i upload.
    oh and hey, you are a life saver with these videos. Everything you are covering is necessary knowledge, except no one at university covers it, no online courses cover it, and the few youtubers who do don't do it well. So from the bottom of my heart, thank you.

  • @gabrielciordas3369
    @gabrielciordas3369 3 ปีที่แล้ว +1

    Your CMake tutorials are so good that I subbed and enabled notifications.

  • @chuongnguyen4980
    @chuongnguyen4980 3 ปีที่แล้ว +4

    Great tutorial. I follow from EP1 to here, but have the error: the main.cpp can not find the "#include " when building, although this file is in build folder after run configure.
    I have to manually add #include "build/OLASConfig.h". Am I missing sth ?
    Thanks.

    • @chuongnguyen4980
      @chuongnguyen4980 3 ปีที่แล้ว +8

      Oh, so I found that using this line does not work for my case (Cmake 3.16.3), :
      target_link_directories(${PROJECT_NAME} PUBLIC ${PROJECT_BINARY_DIR})
      Replace it with the following works now:
      include_directories(${CMAKE_CURRENT_BINARY_DIR})
      Source: cmake.org/cmake/help/latest/command/configure_file.html

    • @rodrickedwards2759
      @rodrickedwards2759 ปีที่แล้ว +1

      @@chuongnguyen4980 Worked for me. Thanks!

  • @YourCRTube
    @YourCRTube 3 ปีที่แล้ว +1

    BTW one can also use the regular ${} syntax instead of @@. The second one is only needed if the file to be transformed already use the first one

  • @followthewhiterabbit7559
    @followthewhiterabbit7559 2 ปีที่แล้ว

    I am really binged on your videos for a couple of hours now, everything is great just the video quality seems to be pretty low in this one. hard to keep up with the things written in files.

  • @KP-nc9gk
    @KP-nc9gk 2 ปีที่แล้ว

    add_compile_definitions in cmake can simplify this right?

  • @sammyiboi
    @sammyiboi 4 ปีที่แล้ว +5

    I'm finding that the best quality for this video is 360p. Maybe try re-uploading?

    • @CodeTechandTutorials
      @CodeTechandTutorials  4 ปีที่แล้ว +2

      AHH I did not notice, not sure why that happened. Thanks for the heads up.

    • @0xredact3d
      @0xredact3d 3 ปีที่แล้ว +1

      @@CodeTechandTutorials Is there an updated version now?

  • @benmclemor2714
    @benmclemor2714 2 ปีที่แล้ว +1

    hello, it does not work for me. I get the error, that OLAFConfig.h cannot be opened. No such file or directory. Does anyone have an idea why?

  • @gru74ik
    @gru74ik 3 ปีที่แล้ว

    I didn't get the point how the project can be built if we didn't create OLASConfig.h header (only OLASConfig.h.in has been created)?

    • @rexyliusde7681
      @rexyliusde7681 3 ปีที่แล้ว +2

      I believe CMake auto-generates the OLASConfig.h file based on OLASConfig.h.in . The Make file then uses the auto-generated OLASConfig.h .

  • @晨晨韩
    @晨晨韩 3 ปีที่แล้ว

    Why should we need two header files, which are h.in and .h ?

    • @salvadorhernandezlopez953
      @salvadorhernandezlopez953 2 ปีที่แล้ว

      because the h.in have the reference if you want to view of the other perspective it have the name of the constant, and the .h have the value

  • @masoodkamandy5370
    @masoodkamandy5370 3 ปีที่แล้ว +10

    Can't tell if they're there or not because of the video quality, but the macro should look like this *with quotes*:
    #define MYPROJECT_VERSION_MAJOR "@MyProject_VERSION_MAJOR@"
    #define MYPROJECT_VERSION_MINOR "@MyProject_VERSION_MINOR@"

  • @Ashish_singh_dev
    @Ashish_singh_dev 11 หลายเดือนก่อน

    project(test VERSION 1.0) //didn't work for me
    //working code NOTE: ORDER SHOULD BE SAME
    project(test)
    set(TEST_VERSION_MAJOR "1")
    set(TEST_VERSION_MINOR "0")
    configure_file(TESTConfig.h.in TESTConfig.h)
    // In TESTConfig.h.in
    #define TEST_VERSION_MAJOR "@TEST_VERSION_MAJOR@"
    #define TEST_VERSION_MINOR "@TEST_VERSION_MINOR@"