[CMake] Can't compile a quite simple Fortran static library
Renato N. Elias
rnelias at nacad.ufrj.br
Wed Aug 20 09:42:31 EDT 2008
Hi folks,
I'm trying to use CMake 2.6 to build a Fortran static library in Visual
Studio 2005 (Fortran Intel Compiler 9.1). All files are in the same
directory.
My CMakeLists.txt file is:
#================================================
cmake_minimum_required(VERSION 2.6)
PROJECT(edgepack_lib Fortran)
FILE(GLOB SRC_FILES *.f)
ADD_DEFINITIONS(-DASLIB)
ADD_LIBRARY(edgepack STATIC ${SRC_FILES})
#==================================================
CMake 2.6 successfully creates the Visual Studio project but, when I hit
the build button, I get the following error message:
1>------ Build started: Project: edgepack, Configuration: Debug Win32 ------
1>Compiling with Intel Fortran 9.1 C:\Arquivos de
programas\Intel\Compiler\Fortran\9.1\IA32\...
1>..\..\src\EdgePack\block3d.f
1>libifcoremt.lib(libifcoremain.obj) : error LNK2019: unresolved
external symbol _MAIN__ referenced in function _main
1>block3d.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build log written to
"file://C:\users\Renato\svn\EdgeCFD-HEAD\CMake-tests\EdgePack\Debug\BuildLog.htm"
1>edgepack build failed.
1>
2>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug Win32
------
2>Project not selected to build for this solution configuration
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 1 skipped ==========
Since I already had a VS2005 project manually configured and working I
compared both compilation lines:
Manually created:
/nologo /Zi /Od /fpp /define:ASLIB /iface:cvf /module:"$(INTDIR)/"
/object:"$(INTDIR)/" /traceback /check:bounds /libs:static /threads
/dbglibs /c
Created by CMake:
/nologo /Zi /fpp /define:ASLIB /define:CMAKE_INTDIR=\"Debug\"
/module:".\$(ConfigurationName)" /object:"$(IntDir)\\" /libs:static
/threads /W1
Any idea about what could be happening?
Regards
Renato.
More information about the CMake
mailing list