# Tutorial. More things that might confuse a stupid person

**URL:** https://discourse.cmake.org/t/tutorial-more-things-that-might-confuse-a-stupid-person/9305
**Category:** Usage
**Created:** [October 30, 2023, 9:35am UTC](https://discourse.cmake.org/t/tutorial-more-things-that-might-confuse-a-stupid-person/9305 "2023-10-30T09:35:19Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![LadyGreyTeaService](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/l/f07891/32.png) [@LadyGreyTeaService](https://discourse.cmake.org/u/LadyGreyTeaService)
#### Post date: [October 30, 2023, 9:35am UTC](https://discourse.cmake.org/t/tutorial-more-things-that-might-confuse-a-stupid-person/9305/1 "2023-10-30T09:35:19Z")

</div>

Another mistake a stupid person might make (don’t ask me how I know) during the tutorial, would be to initially

```auto
cd Step1_build
cmake ../Step1/CMakeLists.txt

```

which creates the make file and other shiz in the Step1 folder instead of the Step1\_build folder, inadvertently polluting the source folder with build artefacts.

* * *

Reading the code in cmProjectCommand.cxx I notice it is written in a complicated way in order to accept a more general grammar for project() than the documentation indicates: the clauses after the project name can be in any order, possibly with languages interspersed, so this is accepted:

```auto
project(Tutorial                                                                                      
    LANGUAGES C ASM                                                                                   
    HOMEPAGE_URL cmake.org                                                                            
    DESCRIPTION "cmake tutorial"                                                                      
    CXX                                                                                               
    VERSION 1.0                                                                                       
    )     

```

Then someone might add OBJC as another language

```auto
project(Tutorial                                                                                      
    LANGUAGES C ASM                                                                                   
    HOMEPAGE_URL cmake.org                                                                            
    DESCRIPTION "cmake tutorial"                                                                      
    CXX                                                                                               
    OBJC
    VERSION 1.0                                                                                       
    )     

```

and then run

```auto
cmake ../Step1

```

again from the Step1\_build directory. No error, cmake saying “Check for working OBJC compiler: /usr/bin/clang - skipped)”.  
But then when I was still in Step1\_build I cleaned out cmake’s previous workings and ran a fresh cmake

```auto
rm -r *
cmake ../Step1

```

and got the error

```auto
The Objective-C compiler                                                                            
                                                                                                     
    "/usr/bin/cc"                                                                                     
                                                                                                      
  is not able to compile a simple test program.

```

I don’t have a working OBJC compiler so this is as expected (AFAIK since I was unable to compile hello world .m)

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [October 30, 2023, 12:49pm UTC](https://discourse.cmake.org/t/tutorial-more-things-that-might-confuse-a-stupid-person/9305/2 "2023-10-30T12:49:13Z")

</div>

> [@LadyGreyTeaService](#):
>
> which creates the make file and other shiz in the Step1 folder instead of the Step1\_build folder, inadvertently polluting the source folder with build artefacts.

I believe this is from the `tutorial.zip` layout? IIRC, `Step1` is a top-level directory in that case. Wording may need to adapt to consider this distribution mechanism.

> [@LadyGreyTeaService](#):
>
> ```auto
> project(Tutorial                                                                                      
> LANGUAGES C ASM                                                                                   
> HOMEPAGE_URL cmake.org                                                                            
> DESCRIPTION "cmake tutorial"                                                                      
> CXX                                                                                               
> VERSION 1.0                                                                                       
> )   
> 
> ```

It is interesting that `CXX` is not in the `LANGUAGES` list but provided separately. Not that I suspect it will fix anything here, but just something I noticed.

Cc: @betsy.mcphail

---

<div class="post-metadata">

### Author: ![LadyGreyTeaService](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/l/f07891/32.png) [@LadyGreyTeaService](https://discourse.cmake.org/u/LadyGreyTeaService)
#### Post date: [October 30, 2023, 4:44pm UTC](https://discourse.cmake.org/t/tutorial-more-things-that-might-confuse-a-stupid-person/9305/3 "2023-10-30T16:44:46Z")

</div>

It’s not the directory structure, it was a mistake I made running `cmake ../Step1/CMakeLists.txt` instead of `cmake ../Step1` which the tutorial correctly told me to do (i.e. I gave it the CMakeLists.txt file instead of the directory). I would have hoped cmake would have told me off for trying to build in the source directory/tree, (by this means or by any other).

Yep you can have CXX out of the languages list and the current code will recognize it (from my reading of the source - I haven’t run it). It appears cmake thinks anything not in the format of an option keyword followed by its parameter(s) is a language, which can to seen by adding something meaningless like WIBBLE (say after CXX) and it will complain it does not understand language WIBBLE. I suspect this is a hang over from the old syntax where the languages were listed without the preceding LANGUAGES keyword.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [October 30, 2023, 5:20pm UTC](https://discourse.cmake.org/t/tutorial-more-things-that-might-confuse-a-stupid-person/9305/4 "2023-10-30T17:20:56Z")

</div>

> [@LadyGreyTeaService](#):
>
> it was a mistake I made running `cmake ../Step1/CMakeLists.txt` instead of `cmake ../Step1`

Ah. I think the command line parsing could probably detect this. @robert.maynard?

> [@LadyGreyTeaService](#):
>
> I suspect this is a hang over from the old syntax where the languages were listed without the preceding LANGUAGES keyword.

Yep. I was more curious at the mixing of the new signature and the old patterns.
