Dear All,
I have a problem with Cmake while choosing the language within a CMakeList.txt. It was explained to me on this list that this is indeed not possible, however a friend pointed me out an "undocumented" feature of CMake. If you initialise the CMakeLists.txt with

Project(MyProject NONE)

you can enable languages within the CMakeLists.txt after having set the CMAKE_<compiler>_COMPILER variable. Most things seem to work, however there is a snag. If I run the attached simple CMakeLists.txt on the mac, I get the following error message

CMake Error at /usr/local/share/cmake-2.7/Modules/ CMakeFindBinUtils.cmake:59 (MESSAGE):
  Could not find install_name_tool, please check your installation.

The reason is that the variable CMAKE_INSTALL_NAME_TOOL is pre-set to be "install_name_tool", so that when in CMakeFindBinUtils.cmake, specifically for the Mac, this program is looked up at line 55, being the variable defined, it is not found. This may have something to do with the comment at line 50 of Darwin.cmake, which talks about an "hack"... This is easily solved uncommenting line 12 of the attached CMakeLists.txt that resets to NOTFOUND the variable.

Is this a bug? Should I submit this to Mantis? Any remarks? Thanks and best regards,

Federico Carminati
CERN-PH
1211 Geneva 23
Switzerland
Tel: +41 22 76 74959
Fax: +41 22 76 68505
Mobile: +41 76 487 4843

# -*- mode: cmake -*-

Project(Test NONE)

Cmake_Minimum_Required(VERSION 2.6)

Message(STATUS ${CMAKE_INSTALL_NAME_TOOL})

Set(CMAKE_Fortran_COMPILER gfortran)
Enable_Language(Fortran)
#Set(CMAKE_Fortran_FLAGS "-fno-second-underscore")
#Set(CMAKE_INSTALL_NAME_TOOL CMAKE_INSTALL_NAME_TOOL-NOTFOUND)
#Find_Program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool)
#Message(STATUS ${CMAKE_INSTALL_NAME_TOOL})
Enable_Language(CXX)

Add_Executable(hello hello.c sub.F)


_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to