<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-forward-container"><br>
      <br>
      -------- Forwarded Message --------
      <table class="moz-email-headers-table" border="0" cellpadding="0"
        cellspacing="0">
        <tbody>
          <tr>
            <th nowrap="nowrap" valign="BASELINE" align="RIGHT">Subject:
            </th>
            <td>Re: Re: [CMake] opening files relative to cmake build
              directory</td>
          </tr>
          <tr>
            <th nowrap="nowrap" valign="BASELINE" align="RIGHT">Date: </th>
            <td>Mon, 13 Jul 2015 17:00:52 +0000</td>
          </tr>
          <tr>
            <th nowrap="nowrap" valign="BASELINE" align="RIGHT">From: </th>
            <td>Owen Alanzo Hogarth <a class="moz-txt-link-rfc2396E" href="mailto:gurenchan@gmail.com"><gurenchan@gmail.com></a></td>
          </tr>
          <tr>
            <th nowrap="nowrap" valign="BASELINE" align="RIGHT">To: </th>
            <td>Micha Hergarden <a class="moz-txt-link-rfc2396E" href="mailto:micha.hergarden@gmail.com"><micha.hergarden@gmail.com></a></td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      <p dir="ltr">Resources.txt is a test but it's mainly going to be
        used for assets at runtime. Maybe in the future I might have
        other directories but this is the only one for now.</p>
      <br>
      <div class="gmail_quote">
        <div dir="ltr">On Tue, Jul 14, 2015, 00:53 Micha Hergarden <<a
            moz-do-not-send="true"
            href="mailto:micha.hergarden@gmail.com">micha.hergarden@gmail.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div bgcolor="#FFFFFF" text="#000000"> Sorry,<br>
            <br>
            I forgot to put you on the reply as well.<br>
            <br>
            Regards,<br>
            Micha</div>
          <div bgcolor="#FFFFFF" text="#000000"><br>
            <div><br>
              <br>
              -------- Forwarded Message --------
              <table border="0" cellpadding="0" cellspacing="0">
                <tbody>
                  <tr>
                    <th nowrap="nowrap" valign="BASELINE" align="RIGHT">Subject:

                    </th>
                    <td>Re: [CMake] opening files relative to cmake
                      build directory</td>
                  </tr>
                  <tr>
                    <th nowrap="nowrap" valign="BASELINE" align="RIGHT">Date:
                    </th>
                    <td>Mon, 13 Jul 2015 18:46:39 +0200</td>
                  </tr>
                  <tr>
                    <th nowrap="nowrap" valign="BASELINE" align="RIGHT">From:
                    </th>
                    <td>Micha Hergarden <a moz-do-not-send="true"
                        href="mailto:micha.hergarden@gmail.com"
                        target="_blank"><micha.hergarden@gmail.com></a></td>
                  </tr>
                  <tr>
                    <th nowrap="nowrap" valign="BASELINE" align="RIGHT">To:
                    </th>
                    <td><a moz-do-not-send="true"
                        href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a></td>
                  </tr>
                </tbody>
              </table>
              <br>
              <br>
              <div>On 07/12/2015 02:14 PM, Owen Alanzo Hogarth wrote:<br>
              </div>
              <blockquote type="cite">
                <div dir="ltr">I have a little project that's setup like
                  this
                  <div><br>
                  </div>
                  <div>project</div>
                  <div>main.c</div>
                  <div>build</div>
                  <div>resources</div>
                  <div>source</div>
                  <div>.../module1</div>
                  <div>.../module2</div>
                  <div>.../etc</div>
                  <div><br>
                  </div>
                  <div>main.c loads dynamic libs from under the source
                    folder.</div>
                  <div><br>
                  </div>
                  <div>I am trying to open up a file using c fopen</div>
                  <div><br>
                  </div>
                  <div><br>
                  </div>
                  <div>
                    <div>I create a function to get the base resource
                      path</div>
                    <div>which returns: /Users/me/projectresources/</div>
                    <div><br>
                    </div>
                    <div>I call get resource with test.txt</div>
                    <div>it'll return a string like this:
                      /Users/me/project/resources/test.txt<br>
                    </div>
                    <div><br>
                    </div>
                    <div>but with my fopen command I get null error</div>
                    <div>Error while opening the file.</div>
                    <div>: No such file or directory</div>
                    <div><br>
                    </div>
                    <div>When I use the c command to find current
                      working directory</div>
                    <div>it returns: </div>
                    <div>Current Directory = /Users/me/project/build/</div>
                    <div><br>
                    </div>
                    <div>how can I set up cmake to allow me to either
                      use the full file path as in
                      Users/me/project/resources/[filename]</div>
                    <div><br>
                    </div>
                    <div>or a relative filename so that I can open my
                      files?</div>
                    <div><br>
                    </div>
                    <div>Best,</div>
                    <div>Owen</div>
                    <div><br>
                    </div>
                  </div>
                  <div><br>
                  </div>
                </div>
                <br>
                <fieldset></fieldset>
                <br>
              </blockquote>
              Hello Owen,<br>
              <br>
              Take a look at: <a moz-do-not-send="true"
                href="http://www.cmake.org/Wiki/CMake_Useful_Variables"
                target="_blank">http://www.cmake.org/Wiki/CMake_Useful_Variables</a><br>
              <br>
              In your case CMAKE_SOURCE_DIR may do what you want. You
              can create a project configuration file and use
              #cmakedefine and CONFIGURE_FILE() to create defines to use
              in your source file. That would provide you with a fixed
              location, suitable for the build you are running now.<br>
              <br>
              What is the purpose of the resources.txt. Is this
              something you need during the creation of your executable?
              Or do you need it during the execution of the program?<br>
              <br>
              Regards,<br>
              Micha<br>
              <br>
            </div>
            <br>
          </div>
        </blockquote>
      </div>
      <br>
    </div>
    <br>
  </body>
</html>