0

I am trying to set up Openscenegraph 3.0.1 with Cmake. I read different blog posts but it doesn't work.

I set up the paths, click compile and selected VS11 (because I have VS 2012) and use native compiler.

Then I directly get this error:

CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules  CMakeCInformation.cmake:37 (get_filename_component):
get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
CMakeLists.txt:3 (PROJECT)


CMake Error: Internal CMake error, TryCompile configure of cmake failed
Looking for include file pthread.h - not found

Also, more errors with the same stack trace occur. Also also could paste them here if you wish.

Afterwards, CMake tells me "Error in configuration process, project files may be invalid"

Bernhard
  • 444
  • 1
  • 4
  • 19
  • Can you locate `pthread.h` in your VS' include path yourself? Could it be that it's missing? (I don't know maybe because Windows like to get less and less POSIX compliant) – Shahbaz Oct 18 '13 at 08:38
  • there is nothing like a pthread.h anywhere on my pc. When I open the generated sln file. VS complains that some project are not loaded (in fact none is loaded) – Bernhard Oct 18 '13 at 08:43
  • I'm afraid I really can't help you with windows related stuff, but I can suggest an improvement. Have you considered using cross-platform tools/libraries instead of windows-specific? If you use `gcc`, `opengl`, `gtk`, `SDL` and others, once you are done with your code, you can actually run it under different operating systems which is quite nice. Is there a reason you would want to bind yourself to the (dying and far-from-standard) windows? – Shahbaz Oct 18 '13 at 08:56
  • @Shahbaz The whole point of CMake is kind of that you don't have to commit to a single environment like GNU or Windows ;) – ComicSansMS Oct 21 '13 at 07:45
  • @ComicSansMS, right, but I was actually referring to Visual Studio (as opposed to MinGW for example). – Shahbaz Oct 21 '13 at 08:30

2 Answers2

0

your problem isn't in compiler version that you are using; in fact, i'm running OpenSceneGraph 3(and osgEarth) with no problems on VisualStudio 2012.

What it seems to be is a problem with Cmake/CMakeLists.txt itself. Try to build some other projects using cmake, to see whether they work, or try to use a version of CMake that is close to what OpenSceneGraph needs(look at CMAKE_MINIMUM_REQUIRED in main CMakeLists.txt file), although CMake language is meant to be compatible with earlier versions, i dont know if this is always the case.

pthread.h has nothing to do with your problem, DOESN'T EXIST in Windows(except if you are using MinGW to look for some more problems), and is not required by OSG - i think, you configured OpenThreads correctly to not use libs you don't have. Anyway, that's just part of the job CMake does on each build - looks for some random stuff, like whether it can find pthreads.h or not, that give CMake some idea about your environment and don't usually relate to the projects you build with cmake. So just ignore that line about pthread.h

Pavel Beliy
  • 494
  • 1
  • 3
  • 14
0

Under normal circumstances, CMake shouldn't be looking for pthread for Windows. Following is the couple of lines in CMake's (2.8) FindThreads.cmake which is used for searching appropriate modules.

  ...      
    CHECK_INCLUDE_FILES("pthread.h" CMAKE_HAVE_PTHREAD_H)
    if(CMAKE_HAVE_PTHREAD_H) 
      ...
    endif()
  ...

  if(CMAKE_SYSTEM MATCHES "Windows")
    set(CMAKE_USE_WIN32_THREADS_INIT 1)
    set(Threads_FOUND TRUE)
  endif()

As you can see, first check should fail and roll out till the second check. However, I believe that in your case, CMake somehow finds that pthread.h (maybe you have MinGW as well) This seems to be a simple conflict in your system. Check your system's PATH etc. and try to fix it.

SylvanBlack
  • 129
  • 1
  • 4