title: CMake Noob segmentation fault issue
body: <p>I'm trying to learn CMake using an example project that calculates the fibonacci of a given number. My project originally included a single ".c" file and header. I was able to build with CMake and run without issue. Now I'm trying to learn how to link libraries by moving my fibnoacci function into a separate ".c" file which I compile into a linkable library using CMake. It builds without issue but throws a segmentation fault when I run it. My project structure is:</p>
  
  <pre><code>fib
  |
  *---MathFunctions
  |   |
  |   *----CMakeLists.txt
  |   |
  |   *----myfib.h
  |
  *---CMakeLists.txt
  |
  *---fib.c
  |
  *---fib.h
  |
  *---myfib.c
  |
  *---Config.in.h
  </code></pre>
  
  <p>The CMakeLists.txt under the MathFunctions folder is empty. All of the program logic is in fib.c and myfib.c. All of the build is in the top CMakeLists.txt</p>
  
  <p>fib.c:</p>
  
  <pre><code># include "stdio.h"
  # include "stdlib.h"
  # include "Config.h"
  #include "myfib.h"
  
  void internalfib(int num)
  {
      printf("Internally defined fib\n");
      int a, b;
      a = 0;
      b = 1;
      printf( "custom fib of %d", b );
      for( int i = 0; i + a &lt;= num; b = i ) {
          i = a + b;
          a = b;
          printf( ", %d", i );
      }
  }
  
  int main( int argc, char** argv) {
      fprintf(stdout,"%s Version %d.%d\n",
                  argv[0],
                  VERSION_MAJOR,
                  VERSION_MINOR);
  #ifdef SHOW_OWNER
      fprintf(stdout, "Project Owner: %s\n", OWNER);
  #endif
      myfib(atof( argv[1] ));
      printf("\n");
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>myfib.c:</p>
  
  <pre><code># include "stdio.h"
  # include "stdlib.h"
  
  void myfib(int num)
  {
      printf("custom myfib");
      int a, b;
      a = 0;
      b = 1;
      printf( "custom fib of %d", b );
      for( int i = 0; i + a &lt;= num; b = i ) {
          i = a + b;
          a = b;
          printf( ", %d", i );
      }
  }
  </code></pre>
  
  <p>CMakeLists.txt:</p>
  
  <pre><code>#Specify the version being used aswell as the language
  cmake_minimum_required(VERSION 2.6)
  #Name your project here
  project(fibonacci)
  enable_testing()
  set (VERSION_MAJOR 1)
  set (VERSION_MINOR 0)
  
  configure_file (
    "${PROJECT_SOURCE_DIR}/Config.h.in"
    "${PROJECT_BINARY_DIR}/Config.h"
    )
  
  option (SHOW_OWNER "Show the name of the project owner" ON)
  
  #Sends the -std=c99 flag to the gcc compiler
  add_definitions(-std=c99)
  
  include_directories("${PROJECT_BINARY_DIR}")
  include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions")
  add_subdirectory (MathFunctions)
  add_library(MathFunctions myfib.c)
  
  #This tells CMake to fib.c and name it fibonacci
  add_executable(fibonacci fib.c)
  target_link_libraries (fibonacci MathFunctions)
  
  #test that fibonacci runs
  add_test (FibonacciRuns fibonacci 5)
  #Test the fibonacci of 5
  add_test (FibonacciCompare5 fibonacci 5)
  
  set_tests_properties (FibonacciCompare5 PROPERTIES PASS_REGULAR_EXPRESSION "1, 1, 2, 3, 5")
  
  install (TARGETS fibonacci DESTINATION ${PROJECT_BINARY_DIR}/bin)
  </code></pre>
  
  <p>After running "..cmake" and "make" from the build folder I run:</p>
  
  <pre><code>~/dev/cworkshop/fib/build$ ./fibonacci
  ./fibonacci Version 1.0
  Project Owner: Clifton C. Craig
  Segmentation fault: 11
  </code></pre>
  
  <p>Where am I going wrong?</p>