The cmake documentation for add_subdirectory() states that the
CMakeLists files in the subdirectories should contain their own
project() command invocation. Your build file in the subdirectory does
not contain one. I don't know that it will be automatically be seen by
CMake as a fortran project because this is what the project in the top
directory is.
Also I don't see the need for the two project files. I know this is what
is done in the tutorial, but you could put everything in the project
file from the top directory.
On 5/3/12 9:25 AM, Vivek Venugopal wrote:
Thanks Kelly.
But i still get this error:
CMake cannot determine linker language for target:helloworld
Thanks,
Vivek
--
Vivek Venugopal
On May 2, 2012, at 6:36 PM, "Thompson, Kelly G" <k...@lanl.gov
<mailto:k...@lanl.gov>> wrote:
My bad. You need to tell CMake that this is a Fortran project. Try
this:
# CMakeLists.txt
cmake_minimum_required(VERSION 2.8.7)
*project(helloworldproject Fortran)*
add_subdirectory(src)
# src/CMakeLists.txt
cmake_minimum_required(VERSION 2.8.7)
file(GLOB helloworld_SOURCES *.f90)
add_executable(helloworld ${helloworld_SOURCES})
-kt
*From:*Vivek Venugopal [mailto:vivek....@gmail.com]
*Sent:* Wednesday, May 02, 2012 11:45 AM
*To:* Thompson, Kelly G
*Subject:* Re: [CMake] Using CMake with ifort compiler
I see an error during generate:
CMake Error: CMake cannot determine linker language for target:helloworld
CMake Error: Cannot determine link language for target "helloworld"
--
Vivek Venugopal
On May 2, 2012, at 12:45 PM, "Thompson, Kelly G" <k...@lanl.gov
<mailto:k...@lanl.gov>> wrote:
Try this:
# CMakeLists.txt
cmake_minimum_required(VERSION 2.8.7)
*project(helloworldproject)*
add_subdirectory(src)
# src/CMakeLists.txt
cmake_minimum_required(VERSION 2.8.7)
file(GLOB helloworld_SOURCES *.f90)
add_executable(helloworld ${helloworld_SOURCES})
-kt
*From:*cmake-boun...@cmake.org <mailto:cmake-boun...@cmake.org>
[mailto:cmake-boun...@cmake.org]
<mailto:[mailto:cmake-boun...@cmake.org]> *On Behalf Of *Vivek
Venugopal
*Sent:* Wednesday, May 02, 2012 9:39 AM
*To:* cmake@cmake.org <mailto:cmake@cmake.org>
*Subject:* [CMake] Using CMake with ifort compiler
I am using CMake 2.8.7 on a Linux machine with Intel 11.0
compilers. I am trying to use CMake for the first time as I would
like to build this project on both Windows and Linux machines.
I though of using a simple approach first and used a standard
Hello World example: My src/HelloWorld.f90:
|!Test helloworld in Fortran using Cmake|
|program hello|
| print *, "Hello World!"|
|end program hello|
My main CMakeLists.txt:
|# States that CMake required version must be greater than 2.8.7|
|cmake_minimum_required(VERSION 2.8.7)|
|enable_language (Fortran)|
|project(helloworld Fortran)|
|add_subdirectory(src)|
|SET_TARGET_PROPERTIES(helloworld PROPERTIES LINKER_LANGUAGE FORTRAN)|
My src/CMakeLists.txt:
|cmake_minimum_required(VERSION 2.8.7)|
| |
|# Include the directory itself as a path to include directories|
|set(CMAKE_INCLUDE_CURRENT_DIR ON)|
| |
|# For a large number of source files you can create it in a simpler way|
|# using file() function:|
|file(GLOB helloworld_SOURCES *.f90)|
I still get an error which says CMAKE_FORTRAN_LINK_EXECUTABLE
variable missing. I looked at Abinader's CMake tutorial#1
<http://www.abinader.com.br/bruno/how-cmake-simplifies-the-build-process-part-1-basic-build-system/>,
but haven't had success so far.
any suggestions?? Thanks in advance !
?]????B??[??[OH???\?^?N?L?\??Y?[Z[N??][??\?X[ ?][??
?][???[??\?\?Y??][?o(?[?H?Y??\?[????[???[?Y?[??HO??[?????????B??]??B??]??B??]??B?????][?O?B??]??B??]??B???O?B??[?B
--
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