[CMake] adding gprof to cmake project

Owen Alanzo Hogarth gurenchan at gmail.com
Sun Nov 29 23:41:01 EST 2015


I have a project with many libs and one executable.

I read this email exchange:
https://cmake.org/pipermail/cmake/2009-December/033979.html

 on adding linker flags but this was from around 2009 and things most
likely have changed a lot since then.

in my executable my cmakelists.txt looks like this

SET(CMAKE_MACOSX_RPATH 1)

FIND_PACKAGE(SDL2 REQUIRED)
FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE_DIRECTORIES( ${OPENGL_INCLUDE_DIR} ${SDL2_INCLUDE_DIR})

SET(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/headers/core_engine.h)
SET(SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/core_engine.c)
SET(TARGET_LIBS ${OPENGL_LIBRARIES} ${SDL2_LIBRARY} core_math
default_shader_2D renderable_2D cam_2d resource_utils timer_utils)

SET(CMAKE_C_FLAGS "-Wall -pg ${CMAKE_C_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "-Wall -pg ${CMAKE_EXE_LINKER_FLAGS}")

ADD_LIBRARY(core_engine SHARED ${SRC_FILES} ${HEADER_FILES})
TARGET_LINK_LIBRARIES(core_engine ${TARGET_LIBS})

i've set the cmake_c_flags as well as the cmake_exe_linker_flags but I
still can't get the output from my executable after running cmake.

How can I add the proper flags?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151130/5cd0521f/attachment.html>


More information about the CMake mailing list