X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=CMakeLists.txt;h=369e03cfc2776f151e51a0b87612580427e06219;hb=5de2f0e3013d4906bf05343dee518929ef979bcc;hp=1e91a68353fba57082846788d47ec76e5c61db85;hpb=d0f635291643df19d68b53f13d3464af6c29e056;p=freeglut diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e91a68..369e03c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,7 +152,7 @@ IF (NOT WIN32) ENDIF() IF(WIN32) - MESSAGE(WARNING "Insecure CRT warnings hidden (might want to fix these)") + # hide insecure CRT warnings, common practice ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) ENDIF() @@ -220,8 +220,8 @@ IF(WIN32) # we also have to generate freeglut.rc, which contains the version # number CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/freeglut.rc.in ${CMAKE_BINARY_DIR}/freeglut.rc) - IF (NOT CMAKE_CL_64) - # .def file only for 32bit Windows builds + IF (MSVC AND NOT CMAKE_CL_64) + # .def file only for 32bit Windows builds with Visual Studio CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/src/freeglutdll.def.in ${CMAKE_BINARY_DIR}/freeglutdll.def) ENDIF() ENDIF() @@ -263,15 +263,13 @@ ELSE() IF(ANDROID) # Not in CMake toolchain file, because the toolchain # file is called several times and generally doesn't - # seem to be meant for it: + # seem to be meant for modifying CFLAGS: # '-mandroid' is not mandatory but doesn't hurt # '-O0 -gstabs+' helps the currently buggy GDB port - # '-DANDROID' is the Android build system convention # Too late to manipulate ENV: SET(ENV{CFLAGS} "$ENV{CFLAGS} -mandroid") # Not using _INIT variables, they seem to be used internally only SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mandroid") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -gstabs+") - ADD_DEFINITIONS(-DANDROID) ENDIF() ENDIF() IF(BUILD_SHARED_LIBS) @@ -346,3 +344,16 @@ IF(FREEGLUT_BUILD_DEMOS) ${DEMO_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR} ) ENDIF() + +# pkg-config support, to install at $(libdir)/pkgconfig +# Define static build dependencies +IF(WIN32) + SET(LIBS_PRIVATE "-lopengl32 -lwinmm -lgdi32") +ELSEIF(ANDROID) + SET(LIBS_PRIVATE "-llog -landroid -lGLESv2 -lEGL") +ELSE() + SET(LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv2 -lEGL") +ENDIF() +CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY) +INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION share/pkgconfig) +# TODO: change the library name when building for GLES, e.g. -lglut-GLES2