I have managed to resolve this issue. The problem was that I only ran cmake once. Running it a second time before running mingw32-make produced the correct results. I guess this has something to do with the cache not having all the right values after just one run.

Stiaan

On 05/19/2011 05:53 PM, Yuri Timenkov wrote:
Sorry, usually there are errors when trying to generate project under cygwin, but cmake uses backslashes.

Then I suggest looking at  xmlparse and  CE_FEMxml dependencies. Because they're static libraries, CMake adds all their dependencies into link command.
You can also check CMake's advanced variables and files in CMakeFiles. There information about system is kept (along with linker and compiler's command line templates).

On Thu, May 19, 2011 at 6:55 PM, Stiaan Gerber <[email protected]> wrote:
On 19/05/11 14:41, Yuri Timenkov wrote:
May be you should use Cygwin build of CMake?

On Thu, May 19, 2011 at 12:46 PM, Stiaan Gerber <[email protected]> wrote:
Dear list
 
On Windows, MinGW (gcc 4.5.2), CMake 2.8.4.
 
I have a project building two executables. The first one builds correctly. On the second one it appears to me as though CMake adds flags to link to the standard MinGW libraries (mingw32, moldname, mingwex, ...) with an incorrect .lib suffix.  (See the output below) As far as I can tell this is totally unnecessary since these flags are automatically added by the gfortran compiler. So in the end I have -lmingw32.lib (presumably added by CMake, which fails) and -lmingw32 (automatically added by gfortran, which correctly links libmingw32.a)
 
My CMakelists file for the target CE_SEMFEM is
-------------------------------------------------------------------------------------------------------
cmake_minimum_required (VERSION 2.8.4)
project (CE_SEMFEM Fortran)
 
set (CE_SRCS
    src/CE_SEMFEM.f95
    src/CE_config_module.f95
)
 
add_executable (CE_SEMFEM ${CE_SRCS})
target_link_libraries (CE_SEMFEM SEMFEM CE_FEMxml xmlparse)
-------------------------------------------------------------------------------------------------------
 
The libraries SEMFEM, CE_FEMxml and xmlparse are built elsewhere in the project.
 
Ideas how I can fix this? Any help is much appreciated.
 
Stiaan
 
-------------------------------------------------------------------------------------------------------
Linking Fortran executable CE_SEMFEM.exe
Driving: C:\MinGW\bin\gfortran.exe -v CMakeFiles/CE_SEMFEM.dir/src/CE_SEMFEM.f95.obj CMakeFiles/CE_SEMFEM.dir/src/CE_con
fig_module.f95.obj -o CE_SEMFEM.exe -LC:\Loher_Berechner_repo\build\Utilities\xml_parser -LC:\Loher_Berechner_repo\build
\SEMFEM\trunk\SEMFEM\core -Lc:\MinGW\lib\gcc\mingw32\4.5.2 -Lc:\MinGW\lib\gcc -Lc:\MinGW\mingw32\lib -Lc:\MinGW\lib -L\M
inGW\lib ..\..\core\SEMFEM.lib ..\..\..\..\..\Utilities\xml_parser\libCE_FEMxml.a ..\..\..\..\..\Utilities\xml_parser\li
bxmlparse.a C:\MPICH2\lib\fmpich2g.lib -lmingw32.lib -lmoldname.lib -lmingwex.lib -lmsvcrt.lib -luser32.lib -lkernel32.l
ib -ladvapi32.lib -lshell32.lib -lmingw32.lib -lmoldname.lib -lmingwex.lib -lmsvcrt.lib -lgfortran -shared-libgcc
Using built-in specs.
COLLECT_GCC=C:\MinGW\bin\gfortran.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.5.2/configure --enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions --wi
th-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-r
untime-libs --disable-werror --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.5.2 (GCC)
COMPILER_PATH=c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/;c:/mingw/bin/../libexec/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.
5.2/../../../../mingw32/bin/
LIBRARY_PATH=c:/mingw/bin/../lib/gcc/mingw32/4.5.2/;c:/mingw/bin/../lib/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../..
/../../mingw32/lib/;c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../;/mingw/lib/
COLLECT_GCC_OPTIONS='-v' '-o' 'CE_SEMFEM.exe' '-LC:\Loher_Berechner_repo\build\Utilities\xml_parser' '-LC:\Loher_Berechn
er_repo\build\SEMFEM\trunk\SEMFEM\core' '-Lc:\MinGW\lib\gcc\mingw32\4.5.2' '-Lc:\MinGW\lib\gcc' '-Lc:\MinGW\mingw32\lib'
 '-Lc:\MinGW\lib' '-L\MinGW\lib' '-shared-libgcc' '-mtune=i386' '-march=i386'
 c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/collect2.exe -Bdynamic -u ___register_frame_info -u ___deregister_frame_info
-o CE_SEMFEM.exe c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../crt2.o c:/mingw/bin/../lib/gcc/mingw32/4.5.2/crtbegin.o
-LC:\Loher_Berechner_repo\build\Utilities\xml_parser -LC:\Loher_Berechner_repo\build\SEMFEM\trunk\SEMFEM\core -Lc:\MinGW
\lib\gcc\mingw32\4.5.2 -Lc:\MinGW\lib\gcc -Lc:\MinGW\mingw32\lib -Lc:\MinGW\lib -L\MinGW\lib -Lc:/mingw/bin/../lib/gcc/m
ingw32/4.5.2 -Lc:/mingw/bin/../lib/gcc -Lc:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/lib -Lc:/mingw/bin/..
/lib/gcc/mingw32/4.5.2/../../.. -L/mingw/lib CMakeFiles/CE_SEMFEM.dir/src/CE_SEMFEM.f95.obj CMakeFiles/CE_SEMFEM.dir/src
/CE_config_module.f95.obj ..\..\core\SEMFEM.lib ..\..\..\..\..\Utilities\xml_parser\libCE_FEMxml.a ..\..\..\..\..\Utilit
ies\xml_parser\libxmlparse.a C:\MPICH2\lib\fmpich2g.lib -lmingw32.lib -lmoldname.lib -lmingwex.lib -lmsvcrt.lib -luser32
.lib -lkernel32.lib -ladvapi32.lib -lshell32.lib -lmingw32.lib -lmoldname.lib -lmingwex.lib -lmsvcrt.lib -lgfortran -lmi
ngw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc_s -lgcc -lmol
dname -lmingwex -lmsvcrt c:/mingw/bin/../lib/gcc/mingw32/4.5.2/crtend.o
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lmingw32.lib
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lmoldname.lib
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lmingwex.lib
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lmsvcrt.lib
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -luser32.lib
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lkernel32.lib
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -ladvapi32.lib
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lshell32.lib
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lmingw32.lib
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lmoldname.lib
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lmingwex.lib
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lmsvcrt.lib
collect2: ld returned 1 exit status
-------------------------------------------------------------------------------------------------------

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


I do not quite understand the suggestion. I do not have Cygwin installed and I do not wish to go that route. I use CMake with the "MinGW Makefiles" generator.

Kind regards
Stiaan

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to