Re: [AD] [A4.4.1.1] Windows profile build fails |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Peter Wang wrote:
On 2011-03-11, Edgar <edgarreynaldo@xxxxxxxxxx> wrote:
If I guess correctly, the undefined references to 'mcount' are because
the '-pg' flag was missing during the profiling library build.
Probably right.
...
You can edit variables in the cmake GUI. You may have to select
"Advanced view" or something like that.
Peter
If I hand edit allegro/build/CMakeFiles/allegro.dir/link.txt and add in
the -pg flag to the library build command, then the profiling build
works as expected.
If I use cmake-gui, there is an entry under
CMAKE_EXE_LINKER_FLAGS_PROFILE that says -pg, so apparently that's not
the right variable for a library build.
I think that the allegro target's LINK_FLAGS property needs to be set
for (at least) GCC and maybe MSVC as well.
Since CMakeFiles.txt already sets the allegro target's LINKS_FLAGS
property to ${ALLEGRO_LINK_FLAGS}, then I propose that we set
ALLEGRO_LINK_FLAGS to "-pg" when compiling with GCC. Does MSVC need this
as well? I don't have MSVC so I can't test it.
I altered allegro/CMakeLists.txt to set ALLEGRO_LINK_FLAGS to "-pg" when
compiling with GCC and ran cmake and make and now the profiling build
works properly.
Attached is a patch that makes this work for me.
--- CMakeLists.txt.old 2011-03-11 23:27:50.374392000 -0600
+++ CMakeLists.txt 2011-03-11 23:21:45.493449000 -0600
@@ -769,6 +769,12 @@
set(allegro_OUTPUT_NAME alleg)
endif()
+if (CMAKE_BUILD_TYPE STREQUAL Profile)
+ if (COMPILER_GCC)
+ set(ALLEGRO_LINK_FLAGS "-pg")
+ endif()
+endif()
+
set_target_properties(allegro
PROPERTIES
COMPILE_FLAGS "-DALLEGRO_SRC ${ALLEGRO_MODULES_PATH_FLAG}"