Kompilieren mit cmake und enthalten debug-Informationen

cmake version 2.8.5

Ich versuche mein Projekt zu kompilieren mit cmake. Allerdings, wenn ich kompilieren, ich glaube nicht, ich bin auch der debug-cflags also -ggdb -D_DEBUG. Als wenn ich versuchen und zu Debuggen, es gibt keine debub info.

Ist es irgendein problem mit der CMakeLists.txt -Dateien. Ich habe 3 von Ihnen

# Mimimum version of cmake required
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

# Name of project
PROJECT(sdp_creator C)

# Check for correct compiler
# Using C compiler GNUCXX for c++ compiler
IF(CMAKE_COMPILER_IS_GNUCC)
  MESSAGE(STATUS "=== GCC C COMPILER DETECTED")
  SET(CMAKE_C_FLAGS "-m32 -ggdb -D_DEBUG -Wextra -Wall -Wunreachable-code -O0 -D_LARGEFILE64_SOURCE")
ENDIF(CMAKE_COMPILER_IS_GNUCC)

# Using windows compiler i.e. msvc++
IF(WIN32)
  MESSAGE(STATUS "=== MSVC COMPILER DETECTED")
ENDIF(WIN32)

# Location of directory where include files are kept
INCLUDE_DIRECTORIES($ENV{HOME}/projects/sdp_creator/src/sdp)
INCLUDE_DIRECTORIES($ENV{HOME}/projects/sdp_creator/src/apr/inc)

# Location of directory where libraries are kept
LINK_DIRECTORIES($ENV{HOME}/projects/sdp_creator/src/apr/lib)

# Add subdirectories
ADD_SUBDIRECTORY(driver)
ADD_SUBDIRECTORY(sdp)

Gebäude shared library:

# Create a shared library called libsdp from sdp.c
# NOTE: static is the default
# NOTE: the lib prefix is automatically added
ADD_LIBRARY(sdp SHARED sdp.c)

Erstellen der ausführbaren Datei:

# Add executable called sdp_creator from source file
ADD_EXECUTABLE(sdp_creator main.c)

# Link the sdp library and other libraries with the excutable 
#if using windows compiler add additional windows libraries
IF(WIN32)
  TARGET_LINK_LIBRARIES(sdp_creator libsdp ws2_32)
  MESSAGE(STATUS "=== Linking executable with windows libraries")
ENDIF(WIN32)

# if using gcc compiler
# NOTE: no need to add the -l prefix i.e. -lsdp, no automatically
IF(CMAKE_COMPILER_IS_GNUCC)
  TARGET_LINK_LIBRARIES(sdp_creator sdp apr-1)
  MESSAGE(STATUS "=== Linking executable with posix libraries")
ENDIF(CMAKE_COMPILER_IS_GNUCC)

Vielen Dank für jeden Rat,

InformationsquelleAutor ant2009 | 2011-12-09

Schreibe einen Kommentar