Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8128471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:53:41+00:00 2026-06-06T07:53:41+00:00

is there a method to link specific files so that I can reference them

  • 0

is there a method to link specific files so that I can reference them inside my code?
I am developing a project where I’m reading in a video file from within my code and I want to reference it like:

const char* videopath = "myvideo.avi"

CMake usually builds inside a newly created directory so that the relative path is unknown to me. Current workaround is to reference the video file as an absolute path like:

videopath = "/home/NewProggie/Video/myvideo.avi"

I was wondering if there is a better way doing this, using CMake?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T07:53:42+00:00Added an answer on June 6, 2026 at 7:53 am

    Check CONFIGURE_FILE!

    In CMakeLists.txt:

    INCLUDE_DIRECTORIES(
      ${CMAKE_CURRENT_SOURCE_DIR}
      ${CMAKE_CURRENT_BINARY_DIR}
    )
    SET(MY_AVI_PATH "${CMAKE_CURRENT_SOURCE_DIR}/movies/foo.avi")
    CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/avi.h.in ${CMAKE_CURRENT_BINARY_DIR}/avi.h @ONLY)
    

    In avi.h.in:

    #pragma once
    #define MY_AVI_PATH L"@MY_AVI_PATH@"
    

    The result avi.h:

    #pragma once
    #define MY_AVI_PATH L"c:\foo\dir\movies\file.avi"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In dapper code in Link.TryAdd method, there is the following piece of code: var
Is there any method I can get the full JSON data from jqGrid when
Is there builtin method that would do this or do I always have to
Is there a method that could tell for a string like foo bar Foo
There is a grid (just html table) that lists users and you can delete
Is there a javascript function I can use to detect whether a specific silverlight
is there a method to verify if a NSString haven't characters? example of string
Is there a method to return the position of the character in the JTextField.
Is there a method which allows to know parent item of leaf tapped item?
Is there a method to launch an Internet Explorer window from a desktop Icon

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.