Hi guys,

I'm trying to cross-compile a project using CMake and gdc (or better: the gdmd port). My CMakeLists-file is the following:

cmake_minimum_required(VERSION 2.8.1)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake-d")
SET(CMAKE_SYSTEM_NAME Linux)

project(myapp D)
set(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} ${GLOBAL_DMD_DEFS}")

set(SOURCES
    main.d
    generic.d
    )

include_directories(.)

add_executable(myapp ${SOURCES})

I'm working on Windows and I want compile the project for the target linux system. So, I downloaded the gdc (x86_64-linux-gnu), extracted it and set the PATH variable. Unfortunately, when I configure my project using CMake, I'm getting the following message:

CMake Error at C:/Users/User/Desktop/Project/cmake-d/CMakeDetermineDCompiler.cmake:32 (MESSAGE):
  Could not find compiler set in environment variable C:

  CMAKE_D_COMPILER-NOTFOUND.
Call Stack (most recent call first):
  CMakeLists.txt:6 (project)


CMake Error: CMAKE_D_COMPILER not set, after EnableLanguage

I think CMake cannot find the compiler because the executables of gdc are named like "x86_64-unknown-linux-gnu-gdc". So, I've added the following to my CMakeLists-file:

set(CMAKE_D_COMPILER x86_64-unknown-linux-gnu-gdmd)

But this also fails with the following error:

The D compiler identification is GNU
Check for working D compiler: C:/Users/User/Compiler/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-gdmd.exe Check for working D compiler: C:/Users/User/Compiler/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-gdmd.exe -- broken
To force a specific D compiler set the DC environment variable
    ie - export DC="/usr/bin/dmd"
CMake Error at C:/Users/User/Desktop/cmake-d/CMakeTestDCompiler.cmake:45 (message):
  The D compiler
"C:/Users/User/Compiler/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-gdmd.exe"
  is not able to compile a simple test program.

  It fails with the following output:

Change Dir: C:/Users/User/Desktop/Project.linux/CMakeFiles/CMakeTmp



  Run Build Command:"C:/Users/User/Compiler/ninja.exe"
  "cmTC_365e1"

  [1/2] Building D object CMakeFiles\cmTC_365e1.dir\testDCompiler


  FAILED: CMakeFiles/cmTC_365e1.dir/testDCompiler



C:\Users\User\Entwicklung\Compiler\x86_64-unknown-linux-gnu\bin\x86_64-unknown-linux-gnu-gdmd.exe
  CMakeFiles\cmTC_365e1.dir\testDCompiler -c
C:\Users\User\Desktop\Project.linux\CMakeFiles\3.7.2\CMakeTmp\testDCompiler.d



  x86_64-unknown-linux-gnu-gdc.exe: error:
CMakeFiles\cmTC_365e1.dir\testDCompiler.d: No such file or directory




  x86_64-unknown-linux-gnu-gdc.exe: fatal error: no input files




  compilation terminated.




Compile of ["CMakeFiles\\cmTC_365e1.dir\\testDCompiler.d"] failed



  ninja: build stopped: subcommand failed.






  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:7 (project)


Configuring incomplete, errors occurred!
See also "C:/Users/User/Desktop/Project.linux/CMakeFiles/CMakeOutput.log".

Does anyone know what can cause the problem here? I've also set the DC environment variable but I'm still getting the errors :(

Reply via email to